ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >Ñ<ÌÌÀÌÌÌÀÌ ÌÌ ÌÌÀ ÀÀÌÌÀÌ À Ì Ì À ÀÌÌÌ Ì Ì ÌÌÀ À ÀÀ À ÀÀ À ÀÀ ÀÀ ÀÌÌ Ì Ì ÌÀ ÌÌÀ ÀÌÌÀÌ ÀÌ À À ÀÀ ÀÌÌ Ì Ì Ì Ì ÌÀ À ÀÀ À ÀÀ À ÀÀ ÀÀ ÀÌÌÌÀÌÌÌÀÌ ÌÌ À À ÀÀÌÌÀÌ ÀÌÌÌ Ì À ÀÀÌ ÌÌÌÀ ÀÀ Ì ÌÌÌÀÌÀÌÀÌ ÀÌ À ÌÌÀ Ì ÌÀÌÀÌÀÌÌÀ ÀÀ ÀÀÌÌÀÌÀ ÌÌÌÀÌÌÌÀ ÌÀ ÀÀ ÀÀÀÀÌÀ ÌÀÌÌÌÌÀ ÀÌ À ÀÀÀÌÌÌ Ì wwwwppwpwwpwwpwwppwpwwwpwwwwwpwwpwwpwpwpwpwwwwpwwwpwpwpwwpwwwwpwpwpwpwwwpwpwwpwwffffff`ff`fff`f`fff`fffff`f`f`fffff`fffff`ffffffff`fff`f`f`ffffffff`fffff``ffff`f`ff`fff`f`ffff`ff`ff`fff`f`ffff`fffff`fffff`f`f`ffff`f`f`fff``f`fff`ff``fffffff```fffffffff`ffff`f````ff`ffffffff`f`f`ff`f````^-- title: Dodge The Blocks -- author: alexander -- desc: simple dodge game -- script: lua -- cover: 0000000000000000000000000000000000000000000000000000000000000000 player = {x=12, y=10} blocks = {} score = 0 level = 1 speed = 0.1 -- viteza blocurilor state = "mainmenu" -- states: mainmenu, levelmenu, play, gameover mainmenu_option = 1 -- 1=Play Normal, 2=Level Selector levelmenu_option = 1 -- nivel selectat move_timer = 0 move_delay = 8 -- număr de frame-uri între miÈ™cări când È›ii apăsat function TIC() cls(0) if state == "play" then update() draw() elseif state == "gameover" then print("GAME OVER!", 100, 60, 12) print("Score: "..score, 100, 70, 12) print("Press Z to return to menu", 60, 80, 12) if btnp(4) then state = "mainmenu" end elseif state == "mainmenu" then drawMainMenu() updateMainMenu() elseif state == "levelmenu" then drawLevelMenu() updateLevelMenu() end end function resetGame() player = {x=12, y=10} blocks = {} score = 0 speed = 0.1 + (level - 1) * 0.05 -- viteza începe mic È™i creÈ™te pe nivel move_timer = 0 state = "play" end function update() move_timer = move_timer + 1 -- MiÈ™care player cu È›inut apăsat (delay între miÈ™cări) if move_timer >= move_delay then local moved = false if btn(0) and player.y > 1 then player.y = player.y - 1; moved = true end if btn(1) and player.y < 11 then player.y = player.y + 1; moved = true end if btn(2) and player.x > 1 then player.x = player.x - 1; moved = true end if btn(3) and player.x < 24 then player.x = player.x + 1; moved = true end if moved then move_timer = 0 end end -- Schimbare nivel automat la praguri de scor if score >= 84 then level = 5 elseif score >= 63 then level = 4 elseif score >= 42 then level = 3 elseif score >= 21 then level = 2 else level = 1 end speed = 0.1 + (level - 1) * 0.05 local block_chance = 0.04 + (level - 1) * 0.03 if math.random() < block_chance then table.insert(blocks, {x=math.random(1,24), y=0}) end for i=#blocks,1,-1 do blocks[i].y = blocks[i].y + speed if math.floor(blocks[i].y) > 11 then table.remove(blocks, i) score = score + 1 else if math.floor(blocks[i].y) == player.y and blocks[i].x == player.x then state = "gameover" end end end end function draw() -- Fundal fix (benzi albastre) for y=1,11 do for x=1,24 do rect(x*6, y*12, 6, 12, 3) end end -- Desenăm bariera marginii (chenar roÈ™u) rectb(6, 12, 24*6, 11*12, 8) for _, b in pairs(blocks) do rect(b.x*6, math.floor(b.y)*12, 6, 12, 8) end rect(player.x*6, player.y*12, 6, 12, 11) print("Score: "..score, 5, 5, 12) print("Level: "..level, 150, 5, 12) end function drawMainMenu() print("DODGE THE BLOCKS", 70, 30, 12) local y_start = 60 local options = {"Play Normal", "Level Selector"} for i=1,#options do local color = 7 if i == mainmenu_option then color = 12 end print(options[i], 90, y_start + (i-1)*20, color) end print("Use UP/DOWN to select", 60, y_start+50, 6) print("Press Z to confirm", 80, y_start+65, 6) end function updateMainMenu() if btnp(0) and mainmenu_option > 1 then mainmenu_option = mainmenu_option -1 elseif btnp(1) and mainmenu_option < 2 then mainmenu_option = mainmenu_option +1 end if btnp(4) then if mainmenu_option == 1 then level = 1 resetGame() elseif mainmenu_option == 2 then levelmenu_option = 1 state = "levelmenu" end end end function drawLevelMenu() print("LEVEL SELECTOR", 80, 30, 12) print("Select Level (1-5):", 70, 50, 12) for i=1,5 do local color = 7 if i == levelmenu_option then color = 12 end print(tostring(i), 110 + (i-1)*15, 70, color) end print("Use Left/Right to select", 40, 90, 6) print("Press Z to start", 70, 110, 6) print("Press ESC to back", 70, 125, 6) end function updateLevelMenu() if btnp(2) and levelmenu_option > 1 then levelmenu_option = levelmenu_option - 1 elseif btnp(3) and levelmenu_option < 5 then levelmenu_option = levelmenu_option + 1 end if btnp(4) then level = levelmenu_option resetGame() elseif btnp(5) then -- ESC (Z+X) state = "mainmenu" end end