a guest Jan 17th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- //Physics for actors
- //grav increases the player's downwards speed by raising vsp.
- vsp += grav;
- //Friction will reduce horizontal speed.
- hsp -= frict * sign(hsp) * grounded;
- //If hsp is lower than the friction value, it just sets hsp to 0.
- if (abs(hsp) < frict)
- hsp = 0;
- //Object carrying function.
- //Adds hspCarry and vspCarry to hsp and vsp.
- vsp += vspCarry;
- hsp += hspCarry;
- //Collision with walls. The player's position is changed after each collision function.
- vsp = floor_collision(vsp);
- hsp = wall_collision(hsp);
- //Stops the player if it is going outside the horizontal edge of the screen.
- if (oob_horizontal(x + hsp))
- hsp = 0;
- //Objects have a terminal velocity. That is to say, there's a cap on how fast an object can move down.
- vsp = min(8, vsp);
- //Objects have a terminal velocity.
- vspFinal = vsp;
- hspFinal = hsp;
- //Actually moves the object.
- y += vspFinal;
- x += hspFinal;
- //Checks if an object is on the ground.
- grounded = bottom(bbox_bottom + 1, ground);
- //These variables control the speed the object is moving at if it's on top of something.
- hspCarry = 0;
- vspCarry = 0;
RAW Paste Data