Jump to content
jeffry

Question about sprites & pixel position

Recommended Posts

I am trying to code my own colision detection.

Everytime I think i have it ... I don't.

 

I am hoping someone get help me get back on track.

 

Suppose my player0 sprtie is a 8x8 square.

If I set player0x = 50 & player0y = 50 which pixel of my sprite will be at coordinates 50,50?

 

123454678

a ########

b ########

c ########

d ########

e ########

f ########

g ########

h ########

 

Is a1? h1? a8? h8? Something else?

 

Also how does using the REFP0 affect this?

 

My code seems to me that everything looks correct yet it doesnt quite work. I believe if I can get a clear answer on which pixel is at the defined coordinate I can figure this out.

 

Thanks for any help to set me straight.

Edited by jeffry

Share this post


Link to post
Share on other sites

Have you played with any of the example programs below? You can move sprites around and see the coordinates in the score:

 

Find Border Coordinates

 

9 Objects with Coordinates

 

13 Objects With Coordinates and Collision (DPC+)

 

It can help you figure out exactly where things are.

Share this post


Link to post
Share on other sites

H1. Reflecting the sprite won't affect the positioning of the sprite.

Edited by kdgarris

Share this post


Link to post
Share on other sites

@Random Terrain

Thanks I had seen that program before in fact i modified it to measure and plot playfields.

I just never thought about utilizing it in this context .. brainfart I guess... Thanks!

P.S. I assume by your name you are the one with the similiarly named website.... SO THANK YOU again. you have given me unmeasurable guidence and help via that site.

 

@kdgarris... Thanks.. I was hopping that not accounting for the REF was part of my problem but alas I screwed up elsewhere

 

Thanks to Both of you!!!!

  • Like 1

Share this post


Link to post
Share on other sites

The answer to your original question actually varies on the kernel used. The standard kernel uses your "h1" as the base. DPC+ uses your "a1". The multisprite kernel regular player uses "h1", and the virtual players are a bit offset from there.

 

The wrinkle to all of these is if you use NUSIZ#=5 or NUSIZ#=7 to modify the player size, it's pushed one pixel to the right.

 

I've put together a boxcollision routine for bB along with some samples, which you may be interested in.

  • Like 1

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