LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

SPHITSP Problem!

Root / Programming Questions / [.]

Stefano_LassandroCreated:
Hi! I'm using smilebasic for 3ds. I have a simple question: If I rotate a sprite (using SPROT x, degree) will the hitbox defined by SPCOL x, TRUE rotate with it? Can I still use SPHITSP correctly? Also, if I set SPHOME in negative, can I still detect the collision (hitbox defined by SPCOL x, TRUE) correctly? Sorry for my bad english, I'm Italian and I'm learning ; ] Thanks

If you rotate a sprite and use SPHITSP, then the hitbox will be the same as if you don't rotate it. In other words, it won't rotate the hitbox.

If you rotate a sprite and use SPHITSP, then the hitbox will be the same as if you don't rotate it. In other words, it won't rotate the hitbox.
Ok! So... if I put the SPHOME in negative or bigger than 16 and then rotate the sprite the hitbox will be in the position of the rotation point of the sprite?

If you rotate a sprite and use SPHITSP, then the hitbox will be the same as if you don't rotate it. In other words, it won't rotate the hitbox.
Ok! So... if I put the SPHOME in negative or bigger than 16 and then rotate the sprite the hitbox will be in the position of the rotation point of the sprite?
I don't understand what your saying but I'll try to explain. If your sprite is originally this ( | ) and you rotate it like this ( — ) then the hitbox will still be this ( | ). This is the same no matter how you rotate it. SPHOME doesn't fix this, it only changes where the "center" of the sprite is.

Hitboxes really don't want to rotate. But you can write a workaround for it, depending on how much precision you need. I found it adequate for my needs to use 4 smaller sprites linked to the intended target, positioned in a rectangle formation, and checking whether those hit instead. Rather than rotate them, they should move as appropriate when the parent sprite rotates. (I think, it's been a while)

Hitboxes really don't want to rotate. But you can write a workaround for it, depending on how much precision you need. I found it adequate for my needs to use 4 smaller sprites linked to the intended target, positioned in a rectangle formation, and checking whether those hit instead. Rather than rotate them, they should move as appropriate when the parent sprite rotates. (I think, it's been a while)

If you rotate a sprite and use SPHITSP, then the hitbox will be the same as if you don't rotate it. In other words, it won't rotate the hitbox.
Ok! So... if I put the SPHOME in negative or bigger than 16 and then rotate the sprite the hitbox will be in the position of the rotation point of the sprite?
I don't understand what your saying but I'll try to explain. If your sprite is originally this ( | ) and you rotate it like this ( — ) then the hitbox will still be this ( | ). This is the same no matter how you rotate it. SPHOME doesn't fix this, it only changes where the "center" of the sprite is.
It's difficult to explain... anyways I understand now!

Hitboxes really don't want to rotate. But you can write a workaround for it, depending on how much precision you need. I found it adequate for my needs to use 4 smaller sprites linked to the intended target, positioned in a rectangle formation, and checking whether those hit instead. Rather than rotate them, they should move as appropriate when the parent sprite rotates. (I think, it's been a while)
I'm trying to find an equation that gives me the coordinates of a point on a circumference knowing the radius, the centre coordinates and the degree of inclination, if anyone has a better idea pls tell me about it! :)

I'm trying to find an equation that gives me the coordinates of a point on a circumference knowing the radius, the centre coordinates and the degree of inclination, if anyone has a better idea pls tell me about it! :)
'angle=radians
X=radius*COS(angle)+centerX
Y=radius*SIN(angle)+centerY

I'm trying to find an equation that gives me the coordinates of a point on a circumference knowing the radius, the centre coordinates and the degree of inclination, if anyone has a better idea pls tell me about it! :)
'angle=radians
X=radius*COS(angle)+centerX
Y=radius*SIN(angle)+centerY
Gotta try it! Thank you so much