ΞΜΜΜ̈ˆˆ¬ͺͺͺ¬ˆˆˆ¬ΜΜΜ¬ΜΐΜ¬ΜΐΜ¬ΜΐΜΜΜμΜξͺͺΐΐξΜ¬ΐΜΐ¬ΐΐΐ¬ΐΐΐ¬ΐΐΞΜΜΜ̈ˆˆ¬ͺͺͺ¬ˆˆˆ¬ΜΜΜ¬ΜΜΜ¬ΜΐΜ¬ΜΐΜΜΜμΜξͺͺΐΐξΜ¬ΐΜΜ¬ΐΐΐ¬ΐΐΐ¬ΐΐ¬ΜΜΜ¬ͺͺͺ¬ͺ¬ͺ¬ͺΚΜ¬ͺͺͺŒˆˆˆΜΐΜΞΜΜΞΜ¬Μͺͺΐμ¬ͺΐξͺͺΐξͺͺΐΜξΐμξΜΜξξ¬ΜΜΜ¬ͺͺͺ¬ͺ¬ͺ¬ͺΚΜ¬ͺͺͺŒˆˆˆΜΐΜΞΜΜΞΜ¬Μͺͺΐμ¬ͺΐξͺͺΐξͺͺΐΜξΐμξΜΜξξ >€?ΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜΜ»»»» ° °» ° ° » »»°»°» °» »»» °»» »» °» »»»» » » »° » » ° ° » °»° ° » ° »»»» » » »° » » ° ° »° »»°»»»»»»» » °»»»» °» »» ΠέΠ Π έέ έέέέ έ έέΠέΠέ έέ ΠέΠέ έέ Π έ Π Π ΠέΠέ Πέέέ έΠ Π Π έΠ Π έ Π έέ Π έΠ έ έ έΠ έ έέ Π Π έ Π έ Πέ έΠ έΠ ΠΠ έΠ έ έ έ ΠέέΠέΠέ έ ΠέΠέ έέΠ έ έέέΠ ΠέΠέέέΠέΠέ» ° »°» »»»»° » °»»» °»»»»»°»»»°»»»°» » »»» ° °°» »»°» °»»»»» ° »° °° »» » ° »° »» »° » »° »°»° °° °°»° °° °° °°»» » » » ° ° °»° » ° » »»» » »» »°»° °° °°»° °° °° °°»° » » »»°» »» ° » °»» °»»»» °»»°»»°» ° °» °» » » ° °»» »»°»»»° °° °°» °έ-- title: Rectangle Droids -- author: N.G. Jose. -- desc: A shooter game -- site: https://www.youtube.com/@ngjose -- license: By installing or using the Game, the Licensee acknowledges that they have read, understood, and agree to be bound by the terms of this Agreement. -- version: 0.1 -- script: lua -- Rectangle Droids Title Screen Script -- Initialize variables local title = "Rectangle Droids" local subtitle = "Press Z to Start" local author = "Created by N.G. Jose" local note = "Note: There is no sound, sorry ;v;" local blink = true local blink_timer = 0 local game_started = false local game_over = false local rect_x, rect_y = 120, 68 -- Starting position of the rectangle local rect_speed = 2 local lasers = {} local enemies = {} local enemy_speed = 1 local enemy_spawn_timer = 0 local player_health = 3 -- Player health local max_health = 3 local chances = 0 -- Counter for enemies reaching the bottom local max_chances = 30 local score = 0 -- Player score function TIC() if not game_started then -- Title screen cls(0) print(title, 40, 30, 12, false, 2) if blink then print(subtitle, 50, 70, 11) end print(author, 40, 120, 13) print(note, 10, 130, 11) -- Display note in the corner blink_timer = blink_timer + 1 if blink_timer > 30 then blink = not blink blink_timer = 0 end if btnp(4) then game_started = true end elseif game_over then -- Game over screen cls(0) print("You lose!", 90, 60, 12) print("Press Z to restart", 60, 80, 12) print("(Good luck again, Sport)", 50, 100, 12) print("Score: " .. score, 90, 120, 12) if btnp(4) then -- Restart the game game_started = false game_over = false rect_x, rect_y = 120, 68 lasers = {} enemies = {} enemy_spawn_timer = 0 player_health = max_health chances = 0 score = 0 end else -- Game screen cls(0) -- Draw the player rectangle outline rectb(rect_x, rect_y, 16, 16, 12) -- Move the player rectangle with collision detection if btn(0) and rect_y > 0 then rect_y = rect_y - rect_speed end -- Up if btn(1) and rect_y < 136 - 16 then rect_y = rect_y + rect_speed end -- Down if btn(2) and rect_x > 0 then rect_x = rect_x - rect_speed end -- Left if btn(3) and rect_x < 240 - 16 then rect_x = rect_x + rect_speed end -- Right -- Shoot laser if btnp(4) then table.insert(lasers, {x = rect_x + 7, y = rect_y}) end -- Update and draw lasers for i = #lasers, 1, -1 do local laser = lasers[i] laser.y = laser.y - 4 if laser.y < 0 then table.remove(lasers, i) else rect(laser.x, laser.y, 2, 4, 11) end end -- Spawn enemies enemy_spawn_timer = enemy_spawn_timer + 1 if enemy_spawn_timer > 30 then table.insert(enemies, {x = math.random(0, 240 - 16), y = -16}) enemy_spawn_timer = 0 end -- Update and draw enemies for i = #enemies, 1, -1 do local enemy = enemies[i] enemy.y = enemy.y + enemy_speed if enemy.y > 136 then table.remove(enemies, i) chances = chances + 1 if chances >= max_chances then game_over = true end elseif rect_x < enemy.x + 16 and rect_x + 16 > enemy.x and rect_y < enemy.y + 16 and rect_y + 16 > enemy.y then player_health = player_health - 1 table.remove(enemies, i) if player_health <= 0 then game_over = true end else rectb(enemy.x, enemy.y, 16, 16, 8) end end -- Check for laser-enemy collisions for i = #lasers, 1, -1 do local laser = lasers[i] for j = #enemies, 1, -1 do local enemy = enemies[j] if laser.x < enemy.x + 16 and laser.x + 2 > enemy.x and laser.y < enemy.y + 16 and laser.y + 4 > enemy.y then table.remove(enemies, j) table.remove(lasers, i) score = score + 5 break end end end -- Draw health bar local health_bar_width = 50 local health_ratio = player_health / max_health rect(10, 10, health_bar_width, 5, 8) -- Background rect(10, 10, health_bar_width * health_ratio, 5, 12) -- Foreground -- Draw chances counter print("Your chances: " .. chances .. "/" .. max_chances, 10, 20, 12) -- Draw score print("Score: " .. score, 10, 30, 12) end end