I need help with my project
I’m working on a slot machine (without real money) and having some issues. How should I change the code to make it fully work? Also, is it possible to add a coin system? The player starts with 10,000 coins, spends 1,000 per spin, and earns: ⁃ 2000 coins for a jackpot (3 matching symbols) ⁃ 1,500 coins if 2 symbols match
This is the current code:
init = function()
cherry = new Sprite("cherry")
diamond = new Sprite("diamond")
star = new Sprite("star")
bell = new Sprite("bell")
seven = new Sprite("seven")
Sprites = ["cherry", "diamond", "star", "bell", "seven"]
slots = ["", "", ""]
message = "Tap the screen to play!"
screen.clear()
screen.drawMap("map", 0, 0, 320, 200)
screen.drawText(message, 0, 85, 20, "")
end
draw = function()
for t in touch.touches
screen.drawSprite(randomSprite(), 0, 0, 70, 70)
screen.drawSprite(randomSprite(), 120, 0, 60, 60)
screen.drawSprite(randomSprite(), -120, 0, 70, 70)
end
end
randomSprite = function()
return Sprites[floor(random.next() * Sprites.length)]
end
playGame = function()
slots[0] = random.nextSprite()
slots[1] = random.nextSprite()
slots[2] = random.nextSprite()
end
if randomSprite() == randomSprite() and randomSprite() == randomSprite() then
message = "💰 JACKPOT! You won! 💰"
else if randomSprite() == randomSprite() or randomSprite() == randomSprite() or randomSprite() == randomSprite() then
message = "💸 Small reward! Two symbols match. 💸"
else
message = " You lost! Try again."
end
end
touchStart = function()
end
update = function()
end