Jump to content
IGNORED

Sprite X coordinates


flux

Recommended Posts

I was having an issue with getting the value for the x coordinate located between two sprites. I took the x value for one of them, plus the x value for the other plus its width and divided it by two. Somehow this still seemed to never be quite right and would always look a little off. I plotted a couple of points in a vertical line and set them to the same x value I was positioning one of the sprites at, and it seems to be off.

 

Then to make sure it wasn't something weird with my own code, I tweaked nyandodge a bit and tried the same thing. I added a PX variable to go along with the PY, and set it to some arbitrary value (in this case 40) at the top where I declared it. Then lower in the code, where it positioned the y value, I added this bit.

    rlist[1].y_=PY
    rlist[1].x_=PX
    COLOUR(1)
    PLOT(PX, 136)
    PLOT(PX, 135)
    PLOT(PX, 134)
    PLOT(PX, 133)
    PLOT(PX, 132)

You can see the results in a screenshot here. My understanding was the the x coordinate of a sprite refers to the left side of it. If that's the case, this line clearly isn't matching up with the left side of that nyan cat. It might be that I don't know enough about how the plot command works or how sprite positions work. If that's the case, could someone talk me through why those things shouldn't line up in that case because I'm scratching my head over here.

Link to comment
Share on other sites

That actually looks like it's it. I guess I haven't really looked into the particle layer too much so it's still a bit of a mystery to me. I didn't realize everything on it was relative to the layer's position. I thought they were straight up screen coordinates. That helps a lot, thanks!

  • Like 1
Link to comment
Share on other sites

That actually looks like it's it. I guess I haven't really looked into the particle layer too much so it's still a bit of a mystery to me. I didn't realize everything on it was relative to the layer's position. I thought they were straight up screen coordinates. That helps a lot, thanks!

 

Once you realise this, and that the particle layer can be shifted around, and that you can have multiple copies of it with multiple CLUT allocations set to them, and you can resize it by editing the .S file and you can scale it just like any other object, ... and... and... well that thing becomes super useful ;-) But as a single backdrop that's on a weird offset and confuses you the first time you start plotting things to it and the co-ords are wacky... yeah, that's not so much fun ;-)

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