TimberDragon wrote:But before i do i want to make a super simple slide on ice tiles, ive search, slide,sliding,icey surface, ice and many other words but ive found nothing that i could truly understand... no big surprises there lol.
Here are some ways of doing this. The easy way is to create a state for sliding, and during those states, move the actor left or right a fixed amount (for instance put that in draw).
A similar method is to create a variable to represent sliding speed and use that to offset the player's x value. During the slide state, you can decrease the variable, to create the slow down effect. And when you collide with the ice and transition to the slide state, make sure to set that variable equal to the actor's xvelocity before using PhysicalResponse.
Another method is to use xvelocity instead of x for movement. This is a little tricky because of how xvelocity and PhysicalResponse conflict, but you can use the trick to prevent sticky walls in a similar way to bypass this.
- Code: Select all
double x_vel = xvelocity;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1, 1, 0, 0);
xvelocity = xvel; // notice this makes it so the xvelocity is set to what it was before the collision