Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Import mojo
- Class RocketGame Extends App
- Field mx:Float
- Field my:Float
- Field player:Rocket
- Method OnCreate ()
- player = New Rocket
- player.image = LoadImage ("player.png", 1, Image.MidHandle)
- SetUpdateRate 60
- End
- Method OnUpdate ()
- mx = MouseX ()
- my = MouseY ()
- player.MovePlayer mx, my
- End
- Method OnRender ()
- Cls 32, 64, 128
- DrawImage player.image, player.x, player.y, 0, 0.25, 0.25
- End
- End
- ' Player object definition...
- Class Rocket
- Field image:Image
- Field x:Float
- Field y:Float
- Field mousediv:Float = 12
- Method MovePlayer (towardsx:Float, towardsy:Float)
- Local xdist:Float = towardsx - x
- Local ydist:Float = towardsy - y
- Local xstep:Float = xdist / mousediv
- Local ystep:Float = ydist / mousediv
- x = x + xstep
- y = y + ystep
- End
- End
- ' Here we go!
- Function Main ()
- New RocketGame
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement