Log In  


I'm having a really hard time with initiating if statements using multiple booleans. It seems I initiate one but then it stays and I can't figure out how to write them properly if I'm dealing with multiple.

In this example I'm trying to set 3 gamescreens with a timer for the 2nd.
The default screen is titlescreen; the initated one on button press is titlescreen1; and then i want gamescreen to happen automatically when the timer finishes.

Problem is gamescreen doesn't initiate and I don't understand why.

countdown=5
time_diff=0
titlescreen=true
titlescreen1=false
gamescreen=false

function _init()
end

function time_lapse()
if time() - time_diff > 1 and countdown > 0 then
countdown-=1
time_diff=time()
end
end

function _update()
if btn(4) then titlescreen1=true end
if titlescreen1==true then time_lapse()
if countdown==0 then gamescreen=true end
elseif gamescreen==true then
end
end

function _draw()
cls()
print("one is happening",33,33,14)
if titlescreen1==true then cls() print(countdown,15,15,14)
elseif gamescreen==true then
cls()
print("gamescreen is active",33,33,14)
end
end



looks like the if/else nesting in your _update function is not what you expect:

if titlescreen1==true then time_lapse()

should pbly be end’ed.



[Please log in to post a comment]