PP00   >#           !-- title: ticdle -- author: mexerica -- desc: a simple clone of wordle -- script: lua game = { alfabet = {'A', 'B','C','D','E','F','G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}, sprites = {1,2,3,4}, --answer = {18, 8, 25, 13, 5}, answer = {}, fi = 1, se = 1, th = 1, fo = 1, fv = 1, fiy = false, sey = false, thy = false, foy = false, fvy = false, fia = false, sea = false, tha = false, foa = false, fva = false, win = false, chances = 5 } word = { ran = math.random(5), randomize = function(self) if self.ran == 1 then game.answer = {18, 8, 25, 13, 5} elseif self.ran == 2 then game.answer = {16, 15, 23, 5, 18} elseif self.ran == 3 then game.answer = {13, 15, 22, 9, 5} elseif self.ran == 4 then game.answer = {23, 1, 20, 3, 8} else game.answer = {1, 21, 4, 9, 15} end end, chances = function() print(game.chances, 20, 10, 9) end } visual = { x = 106, y = 70, draw = function(self, sp) print(sp[game.fi] .. sp[game.se] .. sp[game.th] .. sp[game.fo] .. sp[game.fv], 2000 // 20 + 6, (106-6) - 40, 12, false, 1) end, pointer = function (self, sp) spr(sp, self.x, self.y) end, movepointer = function(self) if btnp(2) and self.x - 6 >= 106 then self.x = self.x - 6 end if btnp(3) and self.x + 6 <= 130 then self.x =self.x + 6 end end, changed = function(self) if btnp(1) then if self.x == 106 then if (game.fi + 1 > 26) then game.fi = 1 else game.fi = game.fi + 1 end elseif self.x == 112 then if (game.se + 1 > 26) then game.se = 1 else game.se = game.se + 1 end elseif self.x == 118 then if (game.th + 1 > 26) then game.th = 1 else game.th = game.th + 1 end elseif self.x == 124 then if (game.fo + 1 > 26) then game.fo = 1 else game.fo = game.fo + 1 end else if (game.fv + 1 > 26) then game.fv = 1 else game.fv = game.fv + 1 end end end end, changeu = function(self) if btnp(0) then if self.x == 106 then if (game.fi - 1 < 1) then game.fi = 26 else game.fi = game.fi - 1 end elseif self.x == 112 then if (game.se - 1 < 1) then game.se = 26 else game.se = game.se - 1 end elseif self.x == 118 then if (game.th - 1 < 1) then game.th = 26 else game.th = game.th - 1 end elseif self.x == 124 then if (game.fo - 1 < 1) then game.fo = 26 else game.fo = game.fo - 1 end else if (game.fv - 1 < 1) then game.fv = 26 else game.fv = game.fv - 1 end end end end, results = function (self, sp) if game.fiy == true then spr(sp[2], 104, 50) else if game.fia == true then spr(sp[3], 104, 50) else spr(sp[4], 104, 50) end end if game.sey == true then spr(sp[2], 110, 50) else if game.sea == true then spr(sp[3], 110, 50) else spr(sp[4], 110, 50) end end if game.thy == true then spr(sp[2], 116, 50) else if game.tha == true then spr(sp[3], 116, 50) else spr(sp[4], 116, 50) end end if game.foy == true then spr(sp[2], 122, 50) else if game.foa == true then spr(sp[3], 122, 50) else spr(sp[4], 122, 50) end end if game.fvy == true then spr(sp[2], 128, 50) else if game.fva == true then spr(sp[3], 128, 50) else spr(sp[4], 128, 50) end end end } gameplay = { check = function(self, an) if btnp(4) then if game.fi == an[1] then game.fiy = true else game.fiy = false if game.fi == an[2] or game.fi == an[3] or game.fi == an[4] or game.fi == an[5] then game.fia = true else game.fia = false end end if game.se == an[2] then game.sey = true else game.sey = false if game.se == an[1] or game.se == an[3] or game.se == an[4] or game.se == an[5] then if game.se ~= game.fi then game.sea = true else game.sea = false end else game.sea = false end end if game.th == an[3] then game.thy = true else game.thy = false if game.th == an[2] or game.th == an[1] or game.th == an[4] or game.th == an[5] then if game.th ~= game.fi and game.th ~= game.se then game.tha = true else game.tha = false end else game.tha = false end end if game.fo == an[4] then game.foy = true else game.foy = false if game.fo == an[2] or game.fo == an[3] or game.fo == an[1] or game.fo == an[5] then if game.fo ~= game.fi and game.fo ~= game.se and game.fo ~= game.th then game.foa = true else game.foa = false end else game.foa = false end end if game.fv == an[5] then game.fvy = true else game.fvy = false if game.fv == an[2] or game.fv == an[3] or game.fv == an[4] or game.fv == an[5] then if game.fv ~= game.fi and game.fv ~= game.se and game.fv ~= game.th and game.fv ~= game.fo then game.fva = true else game.fva = false end else game.fva = false end end game.chances = game.chances - 1 end end, win = function() if game.fiy == true and game.sey == true and game.thy == true and game.foy == true and game.fvy == true then game.win = true end end } final = { win = function() print("You win", 105, 60, 4) print("Press x to restart", 75, 70, 4) end, lose = function() print("You lose", 105, 60, 4) print("Press x to restart", 75, 70, 4) end, restart = function() if btnp(5) then reset() end end } function TIC() if game.win == false and game.chances > 0 then cls() word:randomize() visual:draw(game.alfabet) word:chances() visual:pointer(game.sprites[1]) visual:movepointer() visual:changed() visual:changeu() gameplay:check(game.answer) gameplay:win() visual:results(game.sprites) else if game.win == true then cls(8) final:win() final:restart() else cls(2) final:lose() final:restart() end end end