D
dovenfrosken
Guest
Hello, I have a problem- I need to save random variable, but functions like choose(); update variable every half of second, but I want the randomization of the randomwalk to stop when the character is walking.
//step event
if (patrol){
randomwalk = choose(-1, 1); //random variable
if (walking > 0){ //if walk
walking -= 1; //timer expires
movespeed = 0.4;
dir = randomwalk; //random dir
}
else{
if (staydelay > 0){ //if stay
staydelay -= 1; //timer expires
movespeed = 0; //stay
}
else{ //refill cooldowns
staydelay = staydelaymax;
walking = walkingmax;
}
}
}
//step event
if (patrol){
randomwalk = choose(-1, 1); //random variable
if (walking > 0){ //if walk
walking -= 1; //timer expires
movespeed = 0.4;
dir = randomwalk; //random dir
}
else{
if (staydelay > 0){ //if stay
staydelay -= 1; //timer expires
movespeed = 0; //stay
}
else{ //refill cooldowns
staydelay = staydelaymax;
walking = walkingmax;
}
}
}