
-----------------------------------
MatthewZMD
Tue Jan 06, 2015 1:05 am

Help! How to Run a Timer and Other Commands at the Same Time?
-----------------------------------
What is it you are trying to achieve?
I am making a game, I want to make the user click on an image for a number of times within a limited time.


What is the problem you are having?
I cannot make the timer and clicking image run at the same time.


Describe what you have tried to solve this problem
I tried to create a loop for the timer and then write the codes for clicking the button, but the program will run the timer first...
I also tried to make everything into 1 loop, but the timer and the clicking button countdown decrease at the same pace...

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




%First try
var rangeX, rangeY, button : int
var ending : boolean := false
var healthPoint, timeLeft : int
var notused1, notused2 : int
healthPoint := 50
timeLeft := 20
loop
    timeLeft := timeLeft - 1
    put healthPoint
    put timeLeft
    delay (1000)
    cls
end loop
loop
    buttonwait ("down", rangeX, rangeY, notused1, notused2)
    drawfillbox (250, 300, 600, 700, blue)
    View.Update
    if rangeX >= 250 and rangeX = 300 and rangeY = 250 and rangeX = 300 and rangeY 