Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Player 'Handles the player being drawn and moving in y and x axis
- Field Sprite:Image
- Field Heart:Image = LoadImage("Heart.png")
- Field x:Float = 300
- Field y:Float = 420
- Field Time:Float = 0
- Field Running:Bool = False
- Field Offset:Float = 0
- Field XScale:Float = 1
- Method draw(_x, _y) 'Draws the player
- Running = Prototype_Game.Running
- Time = Prototype_Game.PlayerAnimation
- If Prototype_Game.Facing = -1 Then
- If Running = True Then
- Offset = 48
- Else
- Offset = 32
- End
- Else
- If Running = True Then
- Offset = -16
- Else
- Offset = 0
- End
- End
- If Running = True Then
- XScale = 1.5
- Sprite = LoadImage("CharRunningSet.png")
- Else
- XScale = 1
- Sprite = LoadImage("CharIdleSet.png")
- End
- If Time >= 0 And Time < 200
- DrawImageRect(Sprite, _x + Offset, _y, 0, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 200 And Time < 400
- DrawImageRect(Sprite, _x + Offset, _y, 32, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 400 And Time < 600
- DrawImageRect(Sprite, _x + Offset, _y, 64, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 600 And Time < 800
- DrawImageRect(Sprite, _x + Offset, _y, 96, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 800 And Time < 1000
- DrawImageRect(Sprite, _x + Offset, _y, 128, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 1000 And Time < 1200
- DrawImageRect(Sprite, _x + Offset, _y, 160, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 1200 And Time < 1400
- DrawImageRect(Sprite, _x + Offset, _y, 192, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 1400 And Time < 1600
- DrawImageRect(Sprite, _x + Offset, _y, 224, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 1600 And Time < 1800
- DrawImageRect(Sprite, _x + Offset, _y, 256, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- Elseif Time >= 1800 And Time < 2000
- DrawImageRect(Sprite, _x + Offset, _y, 288, 0, 32, 64, 0, Prototype_Game.Facing*XScale, 1, 0)
- End
- ' DrawImageRect(Sprite, _x, _y, 0, 0, 32, 64, 0, 1, 1, 0)
- ' DrawImage(Sprite, _x, _y, 0, 1 , 1 , 0 )
- End
- Method MoveX(_x:Int) 'moving in x axis
- x+=_x
- If x<16 Then x=16
- If x>1570 Then x=1570
- End
- Method MoveY(_y:Int) 'moving in y axis
- y+=_y
- If y<32 Then y=32
- If y>870 Then y=870
- End
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement