Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, RealSerious3D, BrainSailor), 1,265 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 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 | chip programmers | 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