Rotating a sprite without the collision mask

L

Lerchprinz

Guest
Hi. I am trying to let my player object jump with a somersault... but everytime i jump next to a wall the player gets stuck. when the player isnt rotating, he doesnt get stuck.
I think it is connected to the collision mask. how can i rotate a sprite without letting the collision mask rotate too?
 

Slyddar

Member
Make a draw event, and use draw_sprite_ext() to draw the sprite yourself. Create a variable to represent the image_angle, say "angle", and perform all your rotation calcs on that, then use that in the rotation section.
 

hughrock18

Member
I had a very similar issue with a side scroller i was making.

The problem ended up being the player sprite's collision correction interacting with a wall during a parkour flip. The players mask was rotating with the player during the flip.

I solved the issue with a few lines of simple code occuring before each collision check.

1. Set a tempvar to equal the image_angle.
2. Set the image_angle to 0.
3. Run collision check.
4. Set image_angle to the tempvar.

Coding: you're setting the sprite's angle to 0 (no rotation) for the sake of the collision check then returning the sprite's angle to it's appropriate value.

Graphically: nothing. The sprite DOES technically return to its original state (no rotation) but it goes back to its correct rotation before it's drawn.
 
L

Lerchprinz

Guest
I had a very similar issue with a side scroller i was making.

The problem ended up being the player sprite's collision correction interacting with a wall during a parkour flip. The players mask was rotating with the player during the flip.

I solved the issue with a few lines of simple code occuring before each collision check.

1. Set a tempvar to equal the image_angle.
2. Set the image_angle to 0.
3. Run collision check.
4. Set image_angle to the tempvar.

Coding: you're setting the sprite's angle to 0 (no rotation) for the sake of the collision check then returning the sprite's angle to it's appropriate value.

Graphically: nothing. The sprite DOES technically return to its original state (no rotation) but it goes back to its correct rotation before it's drawn.

maybe i did something wrong, but this didnt work
 
Drawing and collision masks are only related if you decide to use the builtin variables as they work off of each other internally. Just use custom variables to control drawing, save the builtin stuff for collisions, and you'll have the separation you desire. This is essentially a repeat of what @TheSly was saying, but it can't be stressed enough.
 
Top