Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("mini1/mini1.lua")
- require("mini2/mini2.lua")
- require("mini3/mini3.lua")
- function pickAtRandom(last) --Picks a new minigame.
- local rand=math.random(1, 3) --Picks a random number.
- if rand==last then --Checks if the new minigame is the same as the last, and if not, returns the new minigame.
- pickAtRandom(last)
- else
- oldMini=last
- currentMini=rand
- return rand
- end
- end
- function love.load()
- currentMini=pickAtRandom(0)
- oldMini=0
- print(currentMini)
- mini1.load()
- mini2.load()
- mini3.load()
- end
- function love.draw()
- if currentMini==1 then
- mini1.draw()
- elseif currentMini==2 then
- mini2.draw()
- elseif currentMini==3 then
- mini3.draw()
- end
- end
- function love.update(dt)
- if currentMini==1 then
- mini1.update(dt)
- elseif currentMini==2 then
- mini2.update(dt)
- elseif currentMini==3 then
- mini3.update(dt)
- else
- pickAtRandom(oldMini)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement