Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,495 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
HELP!!! #297769
11/09/09 19:21
11/09/09 19:21
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
I've been going at this now for a week.

From Packman2008

Code:
action point()	//the 'dots' (things that pacman likes to eat.)
{
	set(my,PASSABLE);	//so monsters will not stuck with it.
	while (vec_dist(my.x,player.x)>8) 
	{
		my.pan += time_step * 4;
		wait(1);
	}	//way to avoid colision using.
	points -= 1;
	snd_play(eat,50,50);
	ent_remove(me); //pacman 'eats' it and its removed.
}



This code lets packman eat the dots as long as he is close enough. How can I make packman eat when he is close enough to a dot, but only when I press the space key?

Re: HELP!!! [Re: JGGamer] #297772
11/09/09 19:52
11/09/09 19:52
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
istead of this:
while (vec_dist(my.x,player.x)>8)

use this:
while (vec_dist(my.x,player.x)>8&&!key_space)


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: HELP!!! [Re: alibaba] #297806
11/10/09 00:50
11/10/09 00:50
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
Tried that already. The dot still gets eaten - which I find ... interesting.

Re: HELP!!! [Re: JGGamer] #297813
11/10/09 01:56
11/10/09 01:56
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
try it with this instead
while ((vec_dist(my.x,player.x)>8)&&(!key_space))
sometimes the appropriate brackets make all the difference.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: HELP!!! [Re: EvilSOB] #297816
11/10/09 02:17
11/10/09 02:17
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
Nope. Same result. Now if that had worked, it would have cemented my point about how complicated lite-c is in some areas.

Re: HELP!!! [Re: JGGamer] #297824
11/10/09 08:09
11/10/09 08:09
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
ok then try this:

instead of this:
while (vec_dist(my.x,player.x)>8)
{
my.pan += time_step * 4;
wait(1);
} //way to avoid colision using.

put thiss:

while (1)
{
if(vec_dist(my.x,player.x)<8&&key_space)
break;
my.pan += time_step * 4;
wait(1);
} //way to avoid colision using.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: HELP!!! [Re: alibaba] #297830
11/10/09 09:17
11/10/09 09:17
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
The right code is

while (vec_dist(my.x,player.x)>8 || !key_space) ....

You want the point not to be eaten when its far from the player, OR when the space key is not pressed.

Re: HELP!!! [Re: Spirit] #297980
11/11/09 02:07
11/11/09 02:07
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
Thanks Spirit!
That code worked.
You just solved one major problem for me and it was quite simple.
I wasn't not giving the right instruction.
Thanks much, and thanks to those who tried to help.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1