Please help with the code
I would also like to add 2th High score next to in the pannel
Now I only have the Highscore
hiscore=dget(0)
input={}
newhiscore=false
if player and player.score>hiscore then
hiscore=player.score
newhiscore=true
dset(0,hiscore)
end
print(pad0(player.displayscore,5).."0",10,0,7)
if flash and player.score>hiscore then
else
print(pad0(hiscore,5).."0",57,0,7)
end
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
I haven't tested this, but hopefully it should work:
hiscore=dget(0) hiscore2=dget(1) hiscore3=dget(2) if player and player.score>hiscore then hiscore3=hiscore2 hiscore2=hiscore hiscore=player.score else if player and player.score>hiscore2 then hiscore3=hiscore2 hiscore2=player.score else if player and player.score>hiscore3 then hiscore3=player.score end dset(0,hiscore) dset(1,hiscore2) dset(2,hiscore3) |
Note that you may want to use local variables, and move the high scores into a table for better expandability.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
I have next problems
I have now program too large
I d like change this fragment code somethig small
function player_scoreadd(k)
local oldt=player.score
player.score+=k
if player.score>=1500 and oldt<1500 then
lives+=1 end
if player.score>=3000 and oldt<3000 then
lives+=1 end
if player.score>=4500 and oldt<4500 then
lives+=1 end
itd..
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
If the player gets an extra life every 1500 points, you could probably do this (sorry if it's buggy, this is just off the top of my head)
function player_scoreadd(k) local oldt=player.score player.score+=k lives=player.score\1500 > oldt\1500 and lives+1 or lives end |
[Please log in to post a comment]