Created
July 8, 2013 06:09
-
-
Save salmonmoose/5946543 to your computer and use it in GitHub Desktop.
Block Dropper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dropBlocks: function() { | |
for(var y = this.mapsize.y -2; y >= 0; y --) | |
{ | |
for(var x = 0; x < this.mapsize.x; x++) | |
{ | |
if(this.map[x][y] != null) { | |
if(this.map[x][y+1] == null && this.map[x][y].pos.y == y * 64 + this.offset.y) | |
{ | |
this.map[x][y+1] = this.map[x][y]; | |
this.map[x][y] = null; | |
this.map[x][y+1].moveTo(this.map[x][y+1].moveTarget.x, this.map[x][y+1].moveTarget.y + 64, .25); | |
} | |
} else if(y == 0 /*&& this.deckTimer.delta() > 0.1*/) { | |
this.deckTimer.set(); | |
if(this.deal.length <= 0) { this.fillDeal(); } | |
settings = { | |
value: this.dealer.dealCard(), | |
flipped: this.deal.pop() //FIXME: should this come from the dealer too? perhaps.... | |
} | |
this.map[x][y] = this.spawnEntity(EntityCard, this.dealer.deckPos.x, this.dealer.deckPos.y, settings); | |
this.map[x][y].moveTo(x * 64 + this.offset.x, this.offset.y, 0.5); | |
this.map[x][y].flipTo('deal'); | |
this.map[x][y].flip.play(); | |
} | |
} | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment