when you specify a velocity, it is in "pixels per frame".
So xvelocity=8; means that each frame, he will move 8 pixels.
He does not exist in-between. This is how velocity works on all platforms.
Now if he can move into the floor, he can either be below the center of the floor, resulting in a downward collision, or pass through the floor entirely. Even if you use (collision>top side>floor), he will still be at a bad angle to determine resulting physical response velocity.
What it means is that you have to either limit the speed of your actor, or increase the size of the floor so he cannot make it more than halfway through in one frame. This is true for any platformer type game. You'll have to play around with the limiting value to find one that works for you.
draw actor>
- Code: Select all
if(yvelocity<8){yvelocity++;}
This would cap it at 8, because the last allowable increase is at 7, and it will add one more to 8.
As for sticking to the walls, try using separate collisions for the top/bottom and left/right side of the wall. Now on
Collision>left or right side>wall>repeat yes>
- Code: Select all
int tempy=yvelocity;
PysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);
yvelocity=tempy;
This will force him to stop his xvelocity, but maintain his yvelocity.