Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Ayumi, howardR), 499 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
vec_dist driving me insane! #390440
12/30/11 15:02
12/30/11 15:02
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
I am a programmer working with the free version of A8
I am using the command:
Code:
action go_down()
{
	triangle = me;
	if (vec_dist(me.x, character.x) <= 559) //this is the line that's driving me insane!
	{
		wait(1);
		ent_remove(me);
	}
}



and I was playing around with the value in the vec_dist to try and find one to my liking
that's where my problem began.
If the value is anywhere between 0 and 559
nothing happens, the entity never removes itself, no matter where character is
if the value is over 559 (560+) the entity removes itself the second the code compiles.
what am I doing wrong?!
Please help!
Rtsgamer706

Re: vec_dist driving me insane! [Re: rtsgamer706] #390442
12/30/11 15:29
12/30/11 15:29
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
your action is only called once!
you have to add a loop to your action:
Code:
action go_down()
{
	triangle = me;
	while(me)
	{
		if (vec_dist(me.x, character.x) <= 559) //this is the line that's driving me insane!
		{
			ent_remove(me);
			return; //Exit this function
		}
		wait(1);
	}
}




Visit my site: www.masterq32.de
Re: vec_dist driving me insane! [Re: rtsgamer706] #390443
12/30/11 15:30
12/30/11 15:30
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Removed, someone was faster tongue


Last edited by Roel; 12/30/11 15:31.

Check out the throwing game here: The throwing game
Re: vec_dist driving me insane! [Re: MasterQ32] #390447
12/30/11 16:13
12/30/11 16:13
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
I feel so stupid that I didn't see that!
Thanks for pointing it out!
works now!

Re: vec_dist driving me insane! [Re: rtsgamer706] #390448
12/30/11 16:32
12/30/11 16:32
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Another way to go. Not BETTER as such, just different.
Up to you which suits you needs better...
Code:
action go_down()
{
	triangle = me;
	while(vec_dist(me.x, character.x) <= 559)
	{
		//other stuff...
		wait(1);
	}
	ent_remove(me);
}



[EDIT] I second SuperKu's suggestion...



Last edited by EvilSOB; 12/30/11 17:18.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: vec_dist driving me insane! [Re: EvilSOB] #390451
12/30/11 17:06
12/30/11 17:06
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Btw. you should add a second loop before your current loop that waits until the pointer "character" is valid:

while(!character) wait(1);
while(vec_dist...


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

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