From 397e6b1e7b36d9617d894e54c137b10aa2a7de3a Mon Sep 17 00:00:00 2001 From: skejeton Date: Tue, 16 Jul 2024 11:35:21 -0300 Subject: [PATCH] Improve tetris progression (#203) --- demos/tetris/fx.um | 1 - demos/tetris/gameplay.um | 12 ++++++++---- demos/tetris/main.um | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/demos/tetris/fx.um b/demos/tetris/fx.um index b94d8de..a8d87cc 100644 --- a/demos/tetris/fx.um +++ b/demos/tetris/fx.um @@ -5,7 +5,6 @@ import ( "window.um" "gameplay.um" "presets.um" - "global.um" "piece.um" "field.um" "falling_piece.um" diff --git a/demos/tetris/gameplay.um b/demos/tetris/gameplay.um index 46f4b7d..7be8571 100644 --- a/demos/tetris/gameplay.um +++ b/demos/tetris/gameplay.um @@ -1,6 +1,5 @@ import ( "falling_piece.um" - "th.um" "field.um" "input.um" "presets.um" @@ -19,6 +18,7 @@ var ( bag*: m_bag::Bag speed*: real places: int + clears*: int ) fn kind(): int { @@ -36,17 +36,21 @@ fn init*() { falling_piece::reset(kind()) speed = 1 places = 0 + clears = 0 } fn place() { places += 1 - if places % 25 == 0 { - speed += 0.5 - } tspin := falling_piece::isTspin falling_piece::place() streak := field::clearRows() + clears += streak + + if ((clears/10) + 1) != speed { + crazytext::putText("SPEED UP!", 3) + } + speed = (clears/10) + 1 if tspin { global::playSound(&global::audioClearMega) diff --git a/demos/tetris/main.um b/demos/tetris/main.um index 56589d1..e2f0eba 100644 --- a/demos/tetris/main.um +++ b/demos/tetris/main.um @@ -11,12 +11,12 @@ import ( "falling_piece.um" "background.um" "crazytext.um" - "signal.um" ) bgPlaying := true var ( scoreText: ^crazytext::Entry + clearedText: ^crazytext::Entry ) fn init*() { @@ -31,6 +31,7 @@ fn init*() { gameplay::init() crazytext::init() scoreText = crazytext::putText("SCORE: 0", crazytext::lifetimeForever) + clearedText = crazytext::putText("CLEARED: 0", crazytext::lifetimeForever, false) crazytext::putText("ARROW KEYS - MOVE", crazytext::lifetimeForever, false) crazytext::putText("Z, X, C - ROTATE", crazytext::lifetimeForever, false) crazytext::putText("M - MUTE", crazytext::lifetimeForever, false) @@ -46,6 +47,7 @@ fn init*() { bgPlaying = !bgPlaying } scoreText.text = sprintf("SCORE: %d", global::score) + clearedText.text = sprintf("CLEARED: %d", gameplay::clears) gameplay::update() falling_piece::update(gameplay::speed) canvas::drawRect(0x000000FF, rect::mk(0, 0, window::wp.x, window::wp.y))