I am making a small sorting mini-game.
The gameplay is this:
- The player begins with 5 marbles which has 3 different colours (red,blue,yellow) which is displayed on the
right side.
-
There is then 3 boxes in the center which is labeled with its designated color.
-
The player has to then click on the box which belongs to the color of the marble.
Example. If the marble is red you click on the red box,if the marble is blue you click on the blue box, etc.
-
However there is also a count down timer at the upper left hand corner. The player has to finish sorting before the timer goes to 0.
-
Once the player sorts all 5 marbles, the player moves onto the next wave.
-
Each marble is 5 points
-
Eachtime a wave is completed, the number of marbles that has to be sorted increases by 2.
I have managed to setup the coutdown clock, display the boxes, and display the marbles.
However I have some issues:
-
I have no idea how to setup the waves system
-
I have no idea how to make the marbles have a random color(meaning having its color red, blue, or yellow)
-
I have no idea how to make the points system
-
I have no idea how to make the game say game over when the clock hits zero.
How would I setup those systems?
I searched them up and I couldn’t find anything.
Someone please help!
I am really stumped on this.
My code is below. I am pretty sure it is plug and play.
local secondsLeft = 1 \* 60 local clockText = display.newText("1:00", display.contentCenterX, 10, native.systemFontBold, 25) local function updateTime() secondsLeft = secondsLeft - 1 local minutes = math.floor( secondsLeft / 60 ) local seconds = secondsLeft % 60 local timeDisplay = string.format( "%02d:%02d", minutes, seconds ) clockText.text = timeDisplay end local countDownTimer = timer.performWithDelay( 1000, updateTime, secondsLeft ) local redcolor = {1,0,0} local bluecolor = {0,0,1} local yellowcolor = {1,1,0} local redbox = display.newRect(display.contentCenterX-50, display.contentCenterY,160,80) redbox:setFillColor(unpack(redcolor)) local bluebox = display.newRect(display.contentCenterX-50, display.contentCenterY-160,160,80) bluebox:setFillColor(unpack(bluecolor)) local yellowbox = display.newRect(display.contentCenterX-50, display.contentCenterY+160,160,80) yellowbox:setFillColor(unpack(yellowcolor)) local marble1 = display.newCircle(display.contentCenterX+100, display.contentCenterY, 4) local marble2 = display.newCircle(display.contentCenterX+100, display.contentCenterY+20, 4) local marble3 = display.newCircle(display.contentCenterX+100, display.contentCenterY+40, 4) local marble4 = display.newCircle(display.contentCenterX+100, display.contentCenterY+60, 4) local marble5 = display.newCircle(display.contentCenterX+100, display.contentCenterY+80, 4)