flux Posted September 24, 2018 Share Posted September 24, 2018 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. Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 24, 2018 Share Posted September 24, 2018 Quick thought from me, plot will draw on to the particle layer object. That object is positioned on the screen like all others. Therefore if you plot at 10,10 then that will appear on the screen at particlelayer.x+10, particlelayer.y+10 2 Quote Link to comment Share on other sites More sharing options...
flux Posted September 24, 2018 Author Share Posted September 24, 2018 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! 1 Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted October 2, 2018 Share Posted October 2, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.