1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- # player
- (include "playerClass.dd")
- (include "pickup.dd")
- # main class
- ( class world_main World (group
- # stage's paddings
- # useful to control everything that moves inside it
- # also to make sure the game works the same
- # way on different screen sizes, by keeping the
- # samem aspect ratio
- (def int paddingHorizontal)
- (def int paddingVertical )
- # player
- (def playerClass player)
- # pickups
- (def Pickup pickup)
- # clicking the screen moves to next target
- (function input (group) (this.player.slowDown))
- # start
- (function start (group) (group
- (= this.paddingHorizontal 10)
- (= this.paddingVertical 10)
- # init player
- (= this.player (new playerClass))
- (this.player.init)
- # init pickup
- (= this.pickup (new Pickup))
- (= this.pickup.limitX this.paddingHorizontal)
- (= this.pickup.limitY this.paddingVertical)
- (this.pickup.init)
- (= this.pickup.player this.player.sprite)
- ))
- # update
- (function update (group) (group
- (this.player.update)
- (this.pickup.update)
- (if (>= this.player.sprite.x this.pickup.sprite.x)
- (echo "player is right")
- )
- ))
- (function resize (group) (group
- ))
- # assets
- (function assets(group) (group
- (return (array "images/dd_logo.png"))
- ))
- ))
|