Update all remaining games to use text_scaled with scale=2
Updated games: - pong.lua: All text now uses text_scaled with scale=2 - air_hockey.lua: All text now uses text_scaled with scale=2 - asteroids.lua: All text now uses text_scaled with scale=2 - ball.lua: All text now uses text_scaled with scale=2 - breakout.lua: All text now uses text_scaled with scale=2 - counter.lua: All text now uses text_scaled with scale=2 - flappy_bird.lua: All text now uses text_scaled with scale=2 - lunar_lander.lua: All text now uses text_scaled with scale=2 - snake.lua: All text now uses text_scaled with scale=2 - tetris.lua: All text now uses text_scaled with scale=2 All 14 games now have consistent 2x text scaling for better readability.
This commit is contained in:
@@ -87,9 +87,9 @@ function draw()
|
||||
local state = game.vars.state
|
||||
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 35, game.height() / 2 - 30, "AIR HOCKEY", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "First to " .. tostring(MAX_SCORE), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 35, game.height() / 2 - 30, "AIR HOCKEY", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "First to " .. tostring(MAX_SCORE), true)
|
||||
|
||||
elseif state == STATE_PLAYING or state == STATE_GAME_OVER then
|
||||
-- Draw center line
|
||||
@@ -109,14 +109,14 @@ function draw()
|
||||
renderer.circle(math.floor(game.vars.puck_x + 0.5), math.floor(game.vars.puck_y + 0.5), PUCK_RADIUS, true, true)
|
||||
|
||||
-- Draw scores
|
||||
renderer.text(game.width() / 2 - 30, 5, tostring(game.vars.paddle_left_score), true)
|
||||
renderer.text(game.width() / 2 + 20, 5, tostring(game.vars.paddle_right_score), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, 5, tostring(game.vars.paddle_left_score), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 + 20, 5, tostring(game.vars.paddle_right_score), true)
|
||||
|
||||
if state == STATE_GAME_OVER then
|
||||
local winner = game.vars.paddle_left_score > game.vars.paddle_right_score and "Player 1" or "Player 2"
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2 - 20, "GAME OVER", true)
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2, winner .. " Wins!", true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2 - 20, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2, winner .. " Wins!", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -100,8 +100,8 @@ function draw()
|
||||
local state = game.vars.state
|
||||
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 35, game.height() / 2 - 30, "ASTEROIDS", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 35, game.height() / 2 - 30, "ASTEROIDS", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
|
||||
elseif state == STATE_PLAYING or state == STATE_GAME_OVER then
|
||||
-- Draw asteroids (convert to integers)
|
||||
@@ -134,12 +134,12 @@ function draw()
|
||||
end
|
||||
|
||||
-- Draw score
|
||||
renderer.text(10, 10, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(10, 20, "Level: " .. tostring(game.vars.level), true)
|
||||
renderer.text_scaled(10, 10, "Score: " .. tostring(game.vars.score, 2), true)
|
||||
renderer.text_scaled(10, 20, "Level: " .. tostring(game.vars.level, 2), true)
|
||||
|
||||
if state == STATE_GAME_OVER then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2, "GAME OVER", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,10 +71,10 @@ function draw()
|
||||
|
||||
-- Draw status
|
||||
if game.vars.state == STATE_PAUSED then
|
||||
renderer.text(10, 10, "PAUSED - Tap to start", true)
|
||||
renderer.text_scaled(10, 10, "PAUSED - Tap to start", true, 2)
|
||||
else
|
||||
renderer.text(10, 10, "Frames: " .. tostring(game.vars.frame_count), true)
|
||||
renderer.text(10, 25, "Tap to pause", true)
|
||||
renderer.text_scaled(10, 10, "Frames: " .. tostring(game.vars.frame_count, 2), true)
|
||||
renderer.text_scaled(10, 25, "Tap to pause", true, 2)
|
||||
end
|
||||
|
||||
-- Draw velocity vector
|
||||
|
||||
@@ -92,8 +92,8 @@ function draw()
|
||||
local state = game.vars.state
|
||||
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2 - 30, "BREAKOUT", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2 - 30, "BREAKOUT", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
|
||||
elseif state == STATE_PLAYING then
|
||||
-- Draw bricks
|
||||
@@ -115,18 +115,18 @@ function draw()
|
||||
renderer.circle(math.floor(game.vars.ball_x + 0.5), math.floor(game.vars.ball_y + 0.5), BALL_RADIUS, true, true)
|
||||
|
||||
-- Draw score and lives
|
||||
renderer.text(5, 5, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(game.width() - 50, 5, "Lives: " .. tostring(game.vars.lives), true)
|
||||
renderer.text_scaled(5, 5, "Score: " .. tostring(game.vars.score, 2), true)
|
||||
renderer.text_scaled(game.width(, 2) - 50, 5, "Lives: " .. tostring(game.vars.lives), true)
|
||||
|
||||
elseif state == STATE_GAME_OVER then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 20, "GAME OVER", true)
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 20, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
|
||||
elseif state == STATE_LEVEL_COMPLETE then
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2 - 20, "LEVEL COMPLETE!", true)
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2 - 20, "LEVEL COMPLETE!", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -29,21 +29,21 @@ function draw()
|
||||
renderer.clear(true)
|
||||
|
||||
-- Draw title
|
||||
renderer.text(20, 20, "Touch Counter", true)
|
||||
renderer.text_scaled(20, 20, "Touch Counter", true, 2)
|
||||
|
||||
-- Draw count (centered)
|
||||
local count_text = "Count: " .. tostring(game.vars.count)
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 10, count_text, true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 10, count_text, true)
|
||||
|
||||
-- Draw last touch position
|
||||
if game.vars.count > 0 then
|
||||
local pos_text = "Last: (" .. tostring(game.vars.last_x) .. ", " .. tostring(game.vars.last_y) .. ")"
|
||||
renderer.text(20, game.height() - 30, pos_text, true)
|
||||
renderer.text_scaled(20, game.height(, 2) - 30, pos_text, true)
|
||||
|
||||
-- Draw marker at last touch (convert to integers)
|
||||
renderer.circle(math.floor(game.vars.last_x + 0.5), math.floor(game.vars.last_y + 0.5), 5, true, false)
|
||||
end
|
||||
|
||||
-- Draw instructions
|
||||
renderer.text(20, 50, "Tap screen to increment", true)
|
||||
renderer.text_scaled(20, 50, "Tap screen to increment", true, 2)
|
||||
end
|
||||
|
||||
@@ -74,8 +74,8 @@ function draw()
|
||||
local state = game.vars.state
|
||||
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 30, "FLAPPY BIRD", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 30, "FLAPPY BIRD", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
|
||||
elseif state == STATE_PLAYING then
|
||||
-- Draw bird (convert to integer)
|
||||
@@ -94,12 +94,12 @@ function draw()
|
||||
end
|
||||
|
||||
-- Draw score
|
||||
renderer.text(10, 10, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text_scaled(10, 10, "Score: " .. tostring(game.vars.score, 2), true)
|
||||
|
||||
elseif state == STATE_GAME_OVER then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 30, "GAME OVER", true)
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Restart", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 30, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Restart", true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ function draw()
|
||||
local state = game.vars.state
|
||||
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2 - 30, "LUNAR LANDER", true)
|
||||
renderer.text(game.width() / 2 - 70, game.height() / 2 - 5, "Land in the zone safely", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2 + 20, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2 - 30, "LUNAR LANDER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 70, game.height() / 2 - 5, "Land in the zone safely", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2 + 20, "Tap to Start", true)
|
||||
|
||||
elseif state == STATE_PLAYING or state == STATE_LANDED or state == STATE_CRASHED then
|
||||
-- Draw terrain
|
||||
@@ -111,18 +111,18 @@ function draw()
|
||||
end
|
||||
|
||||
-- Draw stats
|
||||
renderer.text(5, 5, "Fuel: " .. tostring(math.floor(game.vars.fuel)), true)
|
||||
renderer.text(5, 15, "Speed: " .. tostring(math.floor(game.vars.lander_vel_y * 10)), true)
|
||||
renderer.text_scaled(5, 5, "Fuel: " .. tostring(math.floor(game.vars.fuel, 2)), true)
|
||||
renderer.text_scaled(5, 15, "Speed: " .. tostring(math.floor(game.vars.lander_vel_y * 10, 2)), true)
|
||||
|
||||
if state == STATE_LANDED then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 20, "LANDED!", true)
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 20, "LANDED!", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
end
|
||||
|
||||
if state == STATE_CRASHED then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 20, "CRASHED!", true)
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 20, "CRASHED!", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,9 +94,9 @@ function draw()
|
||||
|
||||
-- Draw: MENU
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 15, game.height() / 2 - 30, "PONG", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text(game.width() / 2 - 70, game.height() / 2 + 20, "First to " .. tostring(MAX_SCORE), true)
|
||||
renderer.text_scaled(game.width() / 2 - 15, game.height() / 2 - 30, "PONG", true, 2)
|
||||
renderer.text_scaled(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true, 2)
|
||||
renderer.text_scaled(game.width() / 2 - 70, game.height() / 2 + 20, "First to " .. tostring(MAX_SCORE), true, 2)
|
||||
|
||||
-- Draw: PLAYING
|
||||
elseif state == STATE_PLAYING then
|
||||
@@ -115,23 +115,23 @@ function draw()
|
||||
-- Draw scores
|
||||
local left_score_text = tostring(game.vars.paddle_left_score)
|
||||
local right_score_text = tostring(game.vars.paddle_right_score)
|
||||
renderer.text(game.width() / 2 - 30, 5, left_score_text, true)
|
||||
renderer.text(game.width() / 2 + 20, 5, right_score_text, true)
|
||||
renderer.text_scaled(game.width() / 2 - 30, 5, left_score_text, true, 2)
|
||||
renderer.text_scaled(game.width() / 2 + 20, 5, right_score_text, true, 2)
|
||||
|
||||
-- Draw: GAME_OVER
|
||||
elseif state == STATE_GAME_OVER then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 30, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width() / 2 - 40, game.height() / 2 - 30, "GAME OVER", true, 2)
|
||||
|
||||
local winner = "Player 1 Wins!"
|
||||
if game.vars.paddle_right_score > game.vars.paddle_left_score then
|
||||
winner = "Player 2 Wins!"
|
||||
end
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, winner, true)
|
||||
renderer.text_scaled(game.width() / 2 - 50, game.height() / 2, winner, true, 2)
|
||||
|
||||
local final_text = game.vars.paddle_left_score .. " - " .. game.vars.paddle_right_score
|
||||
renderer.text(game.width() / 2 - 25, game.height() / 2 + 20, final_text, true)
|
||||
renderer.text_scaled(game.width() / 2 - 25, game.height() / 2 + 20, final_text, true, 2)
|
||||
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 40, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width() / 2 - 60, game.height() / 2 + 40, "Tap to Menu", true, 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -110,12 +110,12 @@ function draw()
|
||||
|
||||
-- Draw: MENU
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2 - 20, "SNAKE", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2 - 20, "SNAKE", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
|
||||
if game.vars.high_score > 0 then
|
||||
local hs_text = "High: " .. tostring(game.vars.high_score)
|
||||
renderer.text(game.width() / 2 - 30, game.height() / 2 + 20, hs_text, true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 30, game.height() / 2 + 20, hs_text, true)
|
||||
end
|
||||
|
||||
-- Draw: PLAYING
|
||||
@@ -134,16 +134,16 @@ function draw()
|
||||
|
||||
-- Draw score
|
||||
local score_text = "Score: " .. tostring(game.vars.score)
|
||||
renderer.text(5, 5, score_text, true)
|
||||
renderer.text_scaled(5, 5, score_text, true, 2)
|
||||
|
||||
-- Draw: GAME_OVER
|
||||
elseif state == STATE_GAME_OVER then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2 - 20, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2 - 20, "GAME OVER", true)
|
||||
|
||||
local score_text = "Score: " .. tostring(game.vars.score)
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2, score_text, true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2, score_text, true)
|
||||
|
||||
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Continue", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 60, game.height() / 2 + 20, "Tap to Continue", true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -177,8 +177,8 @@ function draw()
|
||||
local state = game.vars.state
|
||||
|
||||
if state == STATE_MENU then
|
||||
renderer.text(game.width() / 2 - 20, game.height() / 2 - 30, "TETRIS", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 20, game.height() / 2 - 30, "TETRIS", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2, "Tap to Start", true)
|
||||
|
||||
elseif state == STATE_PLAYING or state == STATE_GAME_OVER then
|
||||
-- Draw grid
|
||||
@@ -203,12 +203,12 @@ function draw()
|
||||
end
|
||||
|
||||
-- Draw score
|
||||
renderer.text(game.width() - 50, 10, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text(game.width() - 50, 20, "Lines: " .. tostring(game.vars.lines), true)
|
||||
renderer.text_scaled(game.width(, 2) - 50, 10, "Score: " .. tostring(game.vars.score), true)
|
||||
renderer.text_scaled(game.width(, 2) - 50, 20, "Lines: " .. tostring(game.vars.lines), true)
|
||||
|
||||
if state == STATE_GAME_OVER then
|
||||
renderer.text(game.width() / 2 - 40, game.height() / 2, "GAME OVER", true)
|
||||
renderer.text(game.width() / 2 - 50, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 40, game.height() / 2, "GAME OVER", true)
|
||||
renderer.text_scaled(game.width(, 2) / 2 - 50, game.height() / 2 + 20, "Tap to Menu", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user