onLockDown
This commit is contained in:
		
							
								
								
									
										2
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								app.js
									
									
									
									
									
								
							@ -72,7 +72,7 @@ let game = {
 | 
			
		||||
    generate: function(nextPiece=nextQueue.shift()) {
 | 
			
		||||
        nextPiece.lockDelay = stats.lockDelay
 | 
			
		||||
        matrix.piece = nextPiece
 | 
			
		||||
        matrix.piece.onlockdown = game.lockDown
 | 
			
		||||
        matrix.piece.onLockDown = game.lockDown
 | 
			
		||||
    
 | 
			
		||||
        if (matrix.piece.canMove(TRANSLATION.NONE)) {
 | 
			
		||||
            scheduler.setInterval(game.fall, stats.fallPeriod)
 | 
			
		||||
 | 
			
		||||
@ -167,14 +167,19 @@ class Tetromino extends AbstractTetromino {
 | 
			
		||||
            }
 | 
			
		||||
            if (this.canMove(TRANSLATION.DOWN)) {
 | 
			
		||||
                this.locking = false
 | 
			
		||||
                scheduler.clearTimeout(this.onlockdown)
 | 
			
		||||
                scheduler.clearTimeout(this.onLockDown)
 | 
			
		||||
            } else {
 | 
			
		||||
                scheduler.resetTimeout(this.onlockdown, this.lockDelay)
 | 
			
		||||
                scheduler.resetTimeout(this.onLockDown, this.lockDelay)
 | 
			
		||||
                this.locking = true
 | 
			
		||||
            }
 | 
			
		||||
            if (this.ghost.visible) this.updateGhost()
 | 
			
		||||
            return true
 | 
			
		||||
        } else {
 | 
			
		||||
            this.locked = true
 | 
			
		||||
            if (!scheduler.timeoutTasks.has(this.onLockDown))
 | 
			
		||||
                scheduler.setTimeout(this.onLockDown, this.lockDelay)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rotate(rotation) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user