velocity = min(velocity+0.5, 8); // this limits velocity to 8
x+=velocity;
ChangeAnimation("Event Actor", "MaxWalkRight", NO_CHANGE);
velocity = min(velocity+0.90, 8); // this limits velocity to 8
x+=2;
Turon wrote:Is this right? I agusted some of the numbers and stuff, and I had to make "velocity" a variable.
Turon wrote:if I follow this code exact does it make the player go back to the lowest speed after releasing the left or right key?
Turon wrote:another thing I was wondering about is how can I change animation once the player reaches max speed?
Turon wrote:wat if I cud make the running and non running sprite share the same sprite sheet only alow the running to repeat until the key is released!
ChangeAnimation("Event Actor", "MaxWalkLeft", NO_CHANGE);
velocity = min(velocity-0.90, 8); // this limits velocity to 8
if(velocity>=8)ChangeAnimation("Event Actor", "MaxRunLeft", NO_CHANGE);
velocity = min(velocity-0.90, 8); // this limits velocity to 8
Turon wrote:K um luk at this code
- Code: Select all
ChangeAnimation("Event Actor", "MaxWalkLeft", NO_CHANGE);
velocity = min(velocity-0.90, 8); // this limits velocity to 8
if(velocity>=8)ChangeAnimation("Event Actor", "MaxRunLeft", NO_CHANGE);
i have removed the *x-=* thing but now he does not move
skydereign wrote:player -> Draw Actor -> Script Editor
- Code: Select all
x+=velocity;
Turon wrote:and isnt this the code that sets the minimim speed?
- Code: Select all
velocity = min(velocity-0.90, 8); // this limits velocity to 8
velocity = max(velocity-0.9, -8);
Turon wrote:i have removed the *x-=* thing but now he does not moveskydereign wrote:Right. You need to add a line of code in the actor's draw actor event that moves the player based off of the velocity variable.
player -> Draw Actor -> Script Editor
- Code: Select all
x+=velocity;
x+=velocity=2;
Users browsing this forum: No registered users and 1 guest