changing paths, using < and > (PROBLEM SOLVED)

Talk about making games.

changing paths, using < and > (PROBLEM SOLVED)

Postby stevenp » Tue Mar 25, 2008 1:05 pm

i have a big problem, il try to put it simple all the following code is in DRAW ACTOR

if (something something < 100)
{
change path on
}

if (something something > 100)
{
change path off
}

now because this is in draw actor, using < and > is constant so basically my path is being repeated, and never reaches its full duration

how can i create some kind of "lock" mechanism that can make that code only happen once, while in draw actor, using the < and > ( if that is even posible )

or to constantly check if something is < or > but when < or > happens, only do what is inside the code once, kind of like a toggle, and can be locked...
Last edited by stevenp on Tue Mar 25, 2008 9:49 pm, edited 1 time in total.
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: changing paths, using < and > in DRAW actor O_O!?!??

Postby Bee-Ant » Tue Mar 25, 2008 3:40 pm

You need to add "limitator" variable...(limitator or limitater)
call it as "on"
Actor>DrawActor>
Code: Select all
if(something<100)
{
    if(on==0)
    {
        ChangePath("EventActor", "YourPath");
        on=1;    //This is the locking point
    }
}
if(something>=100)
{
    ChangePath("EventActor", "(none)");
}

Actor>PathFinish>YourPath>
Code: Select all
on=0;   //Unlock the Path event

If still doesnt work, use variable to change the movement. Do you want to use it in AI movement? :roll:
Just remember, always use "limitator" variable in DrawActor to avoid that annoying looping :mrgreen:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: changing paths, using < and > in DRAW actor O_O!?!??

Postby Fuzzy » Tue Mar 25, 2008 7:41 pm

mojo domo wrote:
if (something something < 100)
{
change path on
}

if (something something > 100)
{
change path off
}



You also have a little problem with that code. What if "something" is exactly 100? Will Path turn off or on?
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: changing paths, using < and > in DRAW actor O_O!?!??

Postby stevenp » Tue Mar 25, 2008 9:23 pm

omg :shock:

you your code actualy worked on the first time!!! :shock:

TY :D

+1 point
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: changing paths, using < and > in DRAW actor O_O!?!??

Postby pyrometal » Tue Mar 25, 2008 9:29 pm

Looks like I didn't completely understand what your problem was all about in the chat room yesterday... but now I see what you wanted to do more precisely... Sorry for not being that helpful. (It's hard over a busy chat)
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: changing paths, using < and > in DRAW actor O_O!?!??

Postby stevenp » Tue Mar 25, 2008 9:49 pm

np ty for the effort tho :) its the effort that counts
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: changing paths, using < and > (PROBLEM SOLVED)

Postby DilloDude » Tue Mar 25, 2008 10:01 pm

also, you should change the second if to an else if. If it's already greater than 100, it won't be less tha or equal to 100 as well, so there's no need to check.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: changing paths, using < and > (PROBLEM SOLVED)

Postby stevenp » Tue Mar 25, 2008 10:12 pm

i just used 100 and 100 as an example,

the real valused i am using are 450 and 300

its all apart of the complex AI code Thanx wrote for me

basically its the enemy "AGGRO" code or aggrivation

if enemy gets close, chases you, then attacks you once he gets even closer,

if you attack enemy he attacks you

if you run away from enemy he chases you, untill you leave his AGGRO circle ( agro circle different for every enemy )
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron