LoginLogin

Rotated Sprite Collision

Root / Programming Questions / [.]

randoCreated:
So, I'm making an UnderTale style boss fight test, and I am working on implementing laser cannons. So I have it so that it fires the laser and stuff. Before it had the problem where it would only ever hit you with one phase of the laser, and also this problem. I fixed it and you get hit by all phases. But there was also always this problem where you could only get hit if the laser is almost directly verticle. I have everything I know I need, even the SPCOL 0,1 and the IF SPHITSP and stuff, but it only reacts when the laser is close to verticle. I always have the cannons pointing at the center of the screen, and they spawn at random places around the middle, but the player only gets hurt when the laser hitting it is almost verticle or directly veritcle. Please help.

I did more testing an also found out the X of the laser seems limited for collision, while the Y is free. If the X coordinate of the laser origin is further away than about 30 pixels from the center, collision is not detected. Idk why, can anyone help?

Sprite collision ignores rotation

Sprite collision ignores rotation
Is there a way I can change that?

you have to write your own collision detection algorithm

you have to write your own collision detection algorithm
Oooh never done that before lol Time to have fun

you have to write your own collision detection algorithm
Oooh never done that before lol Time to have fun
well, you could also take friendly pellet rain's algorithm. I'm just saying you COULD, not that you SHOULD.

you have to write your own collision detection algorithm
Oooh never done that before lol Time to have fun
well, you could also take friendly pellet rain's algorithm. I'm just saying you COULD, not that you SHOULD.
I'm trying to do this attack tho

you have to write your own collision detection algorithm
Oooh never done that before lol Time to have fun
well, you could also take friendly pellet rain's algorithm. I'm just saying you COULD, not that you SHOULD.
I'm trying to do this attack tho
woah are those gaster blasters? or, uh, Dragon Blasters?

you have to write your own collision detection algorithm
Oooh never done that before lol Time to have fun
well, you could also take friendly pellet rain's algorithm. I'm just saying you COULD, not that you SHOULD.
I'm trying to do this attack tho
woah are those gaster blasters? or, uh, Dragon Blasters?
Yes but the collision doesn't work because of the rotation thing, and I need to make an algorithm that supports that.

btw how do I do this? What I was thinking is to draw a line and check if the player is on the line (of course you can't see it) But I don't know how I would do that.

YES I made it work. What I did is I made a fast-moving sprite go along the laser every time the laser phase changed, therefore making you get hurt when you touched the object (or seemingly the laser)

oh, that's a good idea what you might be able to do is just use SPCOLVEC rather than actually moving the sprite, or even just set the laser's hitbox to be a square and use SPCOLVEC on the laser sprite.

oh, that's a good idea what you might be able to do is just use SPCOLVEC rather than actually moving the sprite, or even just set the laser's hitbox to be a square and use SPCOLVEC on the laser sprite.
Good ideas. I'm to lazy to do them because I'm already done and it shouldn't effect me much, I won't have any other sprites than the player and things to dodge. Here is the key for a small demo: BR5E3WKV There are 3 attacks:
  • Random Cannon: cannons go random places around the center and shoot. This is hard to dodge at high speeds.
  • Circle Cannon: Cannons move around the center in a 32 pointed star, one after the previous. This one can be hard to dodge at high speeds, but you should be fine if you know how to dodge this properly.
  • Star Cannon: Shoots a spray of stars! A slow-rotating 4-pointed star. It shoots the 4 sides one after another, offsets it, and shoots again one after the last.

Gimme your suggestions for attacks.

Remember to add some 1-hit-kill attacks that are random and impossible to dodge

Remember to add some 1-hit-kill attacks that are random and impossible to dodge
YES I will add a mode called Impossible mode that features this

Ok I have made 2 new attacks: Death Ray (that insta-kill attack) and Sidecannon, where the box goes as wide as you and you get shot from the sides. Also, I added box size changing. Screenshots:

Try to survive this! No lag!!! (this is because I managed my sprites carefully lol)

New and improved version key: 5CEDKNV Includes: New and improved files (.CREEPY and the other one without CREEPY in it but with a period at the beginning), Improved BBTEST, challenge/joke creepies (HCREEPY starts off faster, IMPCREEPY starts at top speed and stops only when you die (right at the beginning, over and over.) Also includes: 3D spheres graphic screen generated from Realistic Raytracer I've been working on this just a little bit, and working on other stuff too.