Advertisement
Guest User

adsafdsa

a guest
Feb 25th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. Class Player 'Handles the player being drawn and moving in y and x axis
  2. Field Sprite:Image
  3. Field Heart:Image = LoadImage("Heart.png")
  4. Field x:Float = 300
  5. Field y:Float = 420
  6. Field Time:Float = 0
  7. Field Running:Bool = False
  8. Field Offset:Float = 0
  9. Field XScale:Float = 1
  10.  
  11. Method draw(_x, _y) 'Draws the player
  12. Running = Prototype_Game.Running
  13. Time = Prototype_Game.PlayerAnimation
  14. If Prototype_Game.Facing = -1 Then
  15.  
  16. If Running = True Then
  17. Offset = 48
  18. Else
  19. Offset = 32
  20. End
  21.  
  22. Else
  23. If Running = True Then
  24.  
  25. Offset = -16
  26. Else
  27. Offset = 0
  28. End
  29. End
  30.  
  31. If Running = True Then
  32. XScale = 1.5
  33. Sprite = LoadImage("CharRunningSet.png")
  34. Else
  35. XScale = 1
  36. Sprite = LoadImage("CharIdleSet.png")
  37. End
  38.  
  39.  
  40. If Time >= 0 And Time < 200
  41. DrawImageRect(Sprite, _x + Offset, _y, 0, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  42. Elseif Time >= 200 And Time < 400
  43. DrawImageRect(Sprite, _x + Offset, _y, 32, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  44. Elseif Time >= 400 And Time < 600
  45. DrawImageRect(Sprite, _x + Offset, _y, 64, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  46. Elseif Time >= 600 And Time < 800
  47. DrawImageRect(Sprite, _x + Offset, _y, 96, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  48. Elseif Time >= 800 And Time < 1000
  49. DrawImageRect(Sprite, _x + Offset, _y, 128, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  50. Elseif Time >= 1000 And Time < 1200
  51. DrawImageRect(Sprite, _x + Offset, _y, 160, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  52. Elseif Time >= 1200 And Time < 1400
  53. DrawImageRect(Sprite, _x + Offset, _y, 192, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  54. Elseif Time >= 1400 And Time < 1600
  55. DrawImageRect(Sprite, _x + Offset, _y, 224, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  56. Elseif Time >= 1600 And Time < 1800
  57. DrawImageRect(Sprite, _x + Offset, _y, 256, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  58. Elseif Time >= 1800 And Time < 2000
  59. DrawImageRect(Sprite, _x + Offset, _y, 288, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
  60. End
  61. ' DrawImageRect(Sprite, _x, _y, 0, 0, 32, 64, 0, 1, 1, 0)
  62.  
  63. ' DrawImage(Sprite, _x, _y, 0, 1 , 1 , 0 )
  64. End
  65.  
  66.  
  67. Method MoveX(_x:Int) 'moving in x axis
  68. x+=_x
  69. If x<16 Then x=16
  70. If x>1570 Then x=1570
  71.  
  72. End
  73.  
  74. Method MoveY(_y:Int) 'moving in y axis
  75.  
  76. y+=_y
  77. If y<32 Then y=32
  78. If y>870 Then y=870
  79. End
  80.  
  81. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement