Permalink
Browse files

layout in grid

  • Loading branch information...
1 parent ee4e884 commit 982189c5ae997aaeed46024e31a682ccae0d9fc2 @willmcneilly committed Mar 5, 2014
Showing with 15 additions and 3 deletions.
  1. BIN resources/images/test-sprite.png
  2. +2 −2 scripts/coffee/app.coffee
  3. +13 −1 scripts/coffee/game.coffee
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -8,8 +8,8 @@ module.exports = class ConfectioneryCrush
@registerStates()
registerStates: ->
- @game.state.add('preGame', new PreGame(@game), true)
- @game.state.add('game', new Game(@game))
+ @game.state.add('preGame', new PreGame(@game))
+ @game.state.add('game', new Game(@game), true)
@game.state.add('postGame', new PostGame(@game))
@@ -5,9 +5,21 @@ module.exports = class Game
@game = game
preload: ->
+ @game.load.image('sq', '/assets/images/test-sprite.png')
create: ->
-
+ @squares = @game.add.group()
+ @squares.createMultiple(64, 'sq')
+ @squares.setAll('outOfBoundsKill', true)
+ @squares.forEach(@addSquare, this, false)
update: ->
+
+ render: ->
+
+ addSquare: (sq) ->
+ idx = @squares.getIndex(sq)
+ x = (idx % 8) * 75
+ y = (Math.floor(idx / 8)) * 75
+ sq.reset(x,y)

0 comments on commit 982189c

Please sign in to comment.