Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var _x_sign = sign( x_velocity ); //x_velocity is the same thing as "hspeed" but a custom variable
  2. var _y_sign = sign( y_velocity ); //y_velocity is the same thing as "vspeed" but a custom variable
  3. var _x_abs = abs( x_velocity );
  4. var _y_abs = abs( y_velocity );
  5.  
  6. repeat( _x_abs ) {
  7. if ( place_meeting( x + _x_sign, y, obj_solid_parent ) ) {
  8. break;
  9. } else {
  10. x += _x_sign;
  11. }
  12. }
  13.  
  14. repeat( _y_abs ) {
  15. if ( place_meeting( x, y + _y_sign, obj_solid_parent ) ) {
  16. break;
  17. } else {
  18. y += _y_sign;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement