Advertisement
Guest User

walking script

a guest
Apr 26th, 2013
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #=======================================================
  2. # WALKING SCRIPT BY DAX
  3. # v 1.0
  4. # ------------------------
  5. # This simple script makes your character turn
  6. # before making a step in the chosen direction
  7. #=======================================================
  8.  
  9. class Game_Player < Game_Character
  10.  
  11. # you can edit this value (default = 4 )to set the
  12. Stepdelay = 4 # delay between turning and start walking in frames
  13. # (game runs at 60 fps) => 6 = 1/10 sec
  14.  
  15. #====================================
  16. # updates the steptimer every frame
  17. #====================================
  18. alias :dax_frameupdate_0116 update
  19. def update
  20. dax_frameupdate_0116
  21. @steptimer_dax = Stepdelay unless @steptimer_dax != nil
  22. @steptimer_dax -= 1 unless @steptimer_dax == 0
  23. end
  24.  
  25. #=======================================
  26. #CHANGE DIRECTION BEFORE WALKING
  27. #=======================================
  28.  
  29.  
  30. alias :dax_directionbeforemove_0446 movable?
  31. def movable?
  32.  
  33. @direction_dax = Input.dir4 #Input.dir4 returns 2,4,6,8 if moving down, left, right or top. returns 0 if no directional keys are pressed
  34.  
  35. return false if moving?
  36. unless $game_player.direction == @direction_dax || @direction_dax == 0
  37. set_direction(@direction_dax)
  38. @steptimer_dax = Stepdelay
  39. return false
  40. end
  41. return unless @steptimer_dax == 0
  42. dax_directionbeforemove_0446
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement