Advertisement
Stargrove

Untitled

Nov 18th, 2017
103
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 1 0
  1.  
  2. if state_new
  3. {
  4. scr_resetStateVars();
  5. sprite_index = walkSprite;
  6. imageSpeed = .1;
  7. scr_playerUpdateInputs()
  8. scr_spawnDustParticles(x - (horizontalInputTotal*8), bbox_bottom - 5, 4, irandom_range(4,6));
  9. state_var[1] = 0; // TIMER FOR DUST
  10. }
  11.  
  12. // COLLECT INPUTS
  13. scr_playerUpdateInputs()
  14.  
  15. // WALKING LOGIC
  16. var _oldXVelocitySign = sign(velocity[XVELOCITY]);
  17. scr_xMovement(accel, fric,maxSpeed);
  18.  
  19. // DUST/PARTICLE LOGIC
  20. var _newXVelocitySign = sign(velocity[XVELOCITY])
  21. if (_newXVelocitySign != 0 and _oldXVelocitySign != 0 and _newXVelocitySign != _oldXVelocitySign)
  22. {
  23. scr_spawnDustParticles(x - (_newXVelocitySign*8), bbox_bottom - 5, 4, irandom_range(4,6));
  24. }
  25.  
  26. state_var[1] += 1*global.timeFactor;
  27. if (state_var[1] >= 30)
  28. {
  29. state_var[1] = 0;
  30. scr_spawnDustParticles(x - (_newXVelocitySign*8), bbox_bottom - 5, 4, irandom_range(4,6));
  31. }
  32.  
  33. // ANIMATION AND FACING
  34. scr_playerUpdateFacing();
  35.  
  36. // STATE SWITCHES
  37. if (velocity[XVELOCITY] == 0 and horizontalInputTotal == 0)
  38. {
  39. scr_stateSwitch("Wait");
  40. }
  41.  
  42. if (downPressed)
  43. {
  44. scr_stateSwitch("Crouch");
  45. }
  46.  
  47. if (jumpPressed)
  48. {
  49. scr_stateSwitch("Jump");
  50. }
  51.  
  52. if attackPressed
  53. {
  54. scr_stateSwitch("Aim");
  55. }
  56.  
  57. if !(onGround)
  58. {
  59. scr_stateSwitch("Fall");
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement