Jump to content
KevKelley

DPC+ and Life Counter/Status Bar

Recommended Posts

I wasn't 100% certain. When I placed it in my code I got a rolling screen and some buzzing so I was gonna opt for a separate screen that announces lives but I liked the idea of a status bar for doing something like act as a timer.

Share this post


Link to post
Share on other sites

No minikernels work with the DPC+ kernel out of the box for various reasons that I mention in the text minikernel topic. Once I have it working for the text minikernel, I can probably make a version of the lives/status minikernel that will work with DPC+.

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

I had finally got an opportunity to implement the test code you had posted and it works perfectly!

 

Thank you very much.

 

This little thing had kind of held up some gameplay elements I had wanted to play around with.

Share this post


Link to post
Share on other sites

Now all I have to figure out is how to make the statusbar act as a timer and decrease at a reasonable speed.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

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...