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
1 registered members (TipmyPip), 18,618 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 again #306228
01/20/10 16:00
01/20/10 16:00
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
ok, so now the enemy detects the player and walks towards it. the problem is it wont stop walking cause the loop wont break because it doesnt implement the statement in
================================================
if(dist == 0)
================================================

here are the codes

================================================

action player_cb()
{
ENTITY* enemy = NULL;
//ENEMY IS STANDING ON GROUND=================================================================
VECTOR vFeet;
vec_for_min(vFeet,me);
set(my,FLAG2);
my.STATE = 1;
while(1)
{
//ENEMY IS IDLE===============================================================================
if(my.STATE == 1)
{
//DETECT THE ENEMY============================================================================
c_scan(my.x,my.pan,vector(900,0,900),SCAN_ENTS | SCAN_FLAG2 | IGNORE_ME);
my.ANIMATION += 10 * time_step;
ent_animate(my, "idle", my.ANIMATION, ANM_CYCLE);
if(you)
{
my.ANIMATION = 0;
my.STATE = 2;
enemy = your.PLAYER;
}
}
//PERFORM WALK ANIMATION======================================================================
if(my.STATE == 2)
{
var dist = vec_dist(my.x, your.x);

while(1)
{
if(dist != 0)
{
var distance =-5*time_step;
c_move(me, vector(0,distance,0), NULL, GLIDE);
walk_percentage += 2* distance;
ent_animate(my,"walk",walk_percentage,ANM_CYCLE);

if(dist == 0)
{
my.ANIMATION = 0;
my.STATE = 1;
}
}
wait(1);
}

}
wait(1);
}

}

======================================================

if anyone notices whats wrong please reply. thx a lot.


If you do not know where you are . . .
Ask a villager.
Re: Help again [Re: DirtyDhan] #306233
01/20/10 16:07
01/20/10 16:07
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
seriously... how many times do I have to tell you...?
Stop making a million threads for the same problem, and stop giving them useless names! this makes it very hard for people to find the solution if they are facing the same kind of problem...

THANKS


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Help again [Re: Helghast] #306245
01/20/10 17:59
01/20/10 17:59
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
DirtyDhan, please don't post more than one thread for one problem. Also, please name your thready properly. Names like "Help again" won't help users who have the same problem finding you. Next time you post a double thread you might get a temp ban.

Re: Help again [Re: Lukas] #306305
01/21/10 02:20
01/21/10 02:20
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
Sorry . . .


If you do not know where you are . . .
Ask a villager.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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