MinecraftU / 2021-computer-adventures

Repository for our 2021 Computer Adventures Ruby project!
0 stars 0 forks source link

Add downwards drop and acceleration #45

Closed jamespeilunli closed 3 years ago

jamespeilunli commented 3 years ago

closes #43

You can now press the down arrow to accelerate the tetromino downwards. You can also press the space bar to instantly drop the tetromino to the lowest available space in the current x position.

I now realize I accidentally closed #25 in this PR too. Yay!

dealingwith commented 3 years ago

You're on fire! 🔥

jamespeilunli commented 3 years ago

Thank you!

jamespeilunli commented 3 years ago

It also looks like moved is partially no longer needed. Uhhhhhh

This:

on :key_held do |event|
  if event.key == "down"
    if !moved
      game.tetromino.moved = game.tetromino.move(event.key)
      game.update_gameboard
      game.draw([0, 0], size)
    end
  end
end

does the same thing as this:

on :key_held do |event|
  if event.key == "down"
    game.tetromino.moved = game.tetromino.move(event.key)
    game.update_gameboard
    game.draw([0, 0], size)
  end
end

But when I comment out game.tetromino.moved = game.tetromino.move(event.key), I can no longer move the tetromino.