That's because you start the timer right at the start of your code, by the time the time left has started, the PSP has already spent 1sec loading in graphics and getting to the main loop.
Edit: Oh you meant you wanted 100 seconds. Nevermind then.
Printable View
That's because you start the timer right at the start of your code, by the time the time left has started, the PSP has already spent 1sec loading in graphics and getting to the main loop.
Edit: Oh you meant you wanted 100 seconds. Nevermind then.
now i need to make the hi score save if its higher than the current hi score, how does this work?
-= Double Post =-
also, whats wrong with this:
g2g for lunch now.. ill check back here l8r for answers.Code:if TimeLeft < 1 then
screen:clear
screen:print(200,135,"Game Over, Your score was: "..score,red)
end
jaso you need a parentheses after the screen:clear so it looks like this screen:clear() and for the hi-score do something like this
if highscore < score then
highscore = score
end
wouldnd it be:Zitat:
Zitat von mark.sparky
but i guess it depends.Code:if highscore > score then
highscore = score
end
No, because then if the high score was greater than the score, the high score would be changed to the lower score.Zitat:
Zitat von Grimfate126
no because that would be
if highscore is less than score then
highscore equals score
end
which doesnt make any sense
it still wouldnt save it, when i reset the game, the high score will go down to nil, i want it so it writes the high score to a file. also how would i read the contents of that file? (anyone who helps me will go down on a list of all the people that have helped me and they will get some credit for the finished game)Zitat:
Zitat von Grimfate126
write contentsZitat:
Zitat von JaSo PsP
score = io.open("score.txt","w")
score:write(highscore)
score:close()
read
highscore = io.open("score.txt","r")
thehighscore = highscore:read()
highscore:close()
With the read function, the variable "thehighscore" is you high score read from the file.
this works by the way:
-= Double Post =-Code:if TimeLeft < 1 then
levelTimer:stop()
screen:clear()
screen:print(200,100,"Game Over, Your Score was: "..score,red)
end
thanx, this game is so near completion. ill submit it soon.Zitat:
Zitat von Access_Denied
ps: what does the w and r mean on the io open brackets?
hi score works now
The "w" means write and the "r" means readZitat:
Zitat von JaSo PsP
Go to evilmana.com and look at thier tutorial on reading and writing files. It'll give you a whole list of functions like that.