Jump to content
IGNORED

Using Score for debug puposes.


Gorf

Recommended Posts

I want to use the score as a sort of debug print, Im trying to print up the x y values

of some sprites to see where they are. I want to use the 3 top digits for x and the

lower 3 for y. Is there any way to do this with out to much crazy BCD stuff?

 

Scadoobie Floinkenburger indeed!

 

:P

Link to comment
Share on other sites

Is there any way to do this with out to much crazy BCD stuff?

 

Sure. When your program starts, set the score so it matches your sprite position (eg, playerx=40, playery=30, score=040030). From then on, when you change the sprite position, change the score at the same time (eg, playerx=playerx+2, score=score+2000. playery=playery-1, score=score-1).

 

Just let bBasic do all that crazy BCD for you.

Link to comment
Share on other sites

I want to use the score as a sort of debug print, Im trying to print up the x y values

of some sprites to see where they are. I want to use the 3 top digits for x and the

lower 3 for y. Is there any way to do this with out to much crazy BCD stuff?

 

Scadoobie Floinkenburger indeed!

 

:P

I do this all the time. A slightly different way I do it than what Glenn Jupp said is to first set the score to where the sprite is, so if you have player0x = 80 and player0y = 10 then set score for 80010 then, when you move your sprite to the left 1 unit (player0x = player0x - 1) then go score = score - 1000 from score, or if you go right then score = score + 1000. If you go up then of course it's score = score - 1 or score = score + 1 for moving up.

 

Oops, I'm editing this post to say that after looking at Glenn's post, I guess I just repeated what he said. My mistake.

Edited by jbs30000
Link to comment
Share on other sites

Now that I've thought a little more on it, another way to go would be to use a SCORE.ASM routine that's modified to display the full hexidecimal set (0-9,A-F) and then work with the three bytes of the score (sc1, sc2, sc3). Could show a whole 'nother byte that way. But then you have to do that crazy BCD (my new favourite phrase) in your head.

Link to comment
Share on other sites

Now that I've thought a little more on it, another way to go would be to use a SCORE.ASM routine that's modified to display the full hexidecimal set (0-9,A-F) and then work with the three bytes of the score (sc1, sc2, sc3). Could show a whole 'nother byte that way. But then you have to do that crazy BCD (my new favourite phrase) in your head.

 

 

Nah, the method you already explained will do just nicely as most of the positions I want to know are in the middle of the screen any way.

 

Agian, thanks.

 

:)

Link to comment
Share on other sites

Anyways, in case no one has posted it, here is a hexadecimal score_graphics.asm.

 

Thanks fer posting that. I know there was talk of such a thing, but I didn't recall if it had actually been done/posted. And yah, it is hex, but I meant to say that you'll have to convert from hex to decimal in head. Of course, proper programmers should naturally think in hex instead of decimal (and real programmers should think exclusively in binary).

 

Or something like that...

Link to comment
Share on other sites

But then you have to do that crazy BCD (my new favourite phrase) in your head.

 

Actually it's not BCD in that case (which is binary coded decimal), but hexadecimal.

 

Anyways, in case no one has posted it, here is a hexadecimal score_graphics.asm.

 

 

Thanks for posting the source...it is being put to good use.

 

:)

 

Steve

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