Jump to content
IGNORED

DPC+ and Life Counter/Status Bar


KevKelley

Recommended Posts

Okay. Thanks. I was playing around with a separate screen and I like the idea of a graphic appearing with a life total. I was having a hard time trying to use the title screen wizard so I guess this will be an opportunity for me to learn! I'll keep my eyes on any development...

Link to comment
Share on other sites

No worries, yeah all depends how you're wanting to implement a counter and what for. There is many ways and im sure everyone has their own methods. Personally for a simple global counter i would throw something like this in the mainloop. You can use the same global counter for other features in your game aswell.

 rem x = milliseconds
 x = x + 1
 
 rem y = seconds
 if x = 60 then x = 0 : y = y + 1

 if y = 10 then pfscore2 = %01111111
 if y = 20 then pfscore2 = %00111111
 if y = 30 then pfscore2 = %00011111
 if y = 40 then pfscore2 = %00001111
 if y = 50 then pfscore2 = %00001111
 if y = 60 then pfscore2 = %00000011
 if y = 70 then pfscore2 = %00000001
 if y = 80 then pfscore2 = %00000000 : goto GAMEOVER or whatever

or

 if x = 0 && y = 10 then pfscore2 = pfscore2/2
 if x = 0 && y = 20 then pfscore2 = pfscore2/2
 if x = 0 && y = 30 then pfscore2 = pfscore2/2
 if x = 0 && y = 40 then pfscore2 = pfscore2/2
 if x = 0 && y = 50 then pfscore2 = pfscore2/2
 if x = 0 && y = 60 then pfscore2 = pfscore2/2
 if x = 0 && y = 70 then pfscore2 = pfscore2/2
 if x = 0 && y = 80 then pfscore2 = pfscore2/2 : goto GAMEOVER

So basically the statusbar decrements approximately every 10 seconds. Obviously you can define the x & y variables to whatever you like aswell.

 

You could also use a "for" loop, but for simplicity and understanding purposes i wrote this.

Link to comment
Share on other sites

Thanks again! I had wound up using a scheme similar to the first option and had indeed considered using a global counter.

 

So far I have it set to decrease one position every couple of seconds but can increase from a collision between the player and its target. I will eventually try to make a power up that can increase or stop the clock.

 

I guess what tripped me up was that I thought the mini kernel was the only way. I had tried to make some kind of pfpixel counter to some success but didn't like the appearance. With this I like that it fills the blank space on either end of the score.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...