Windows How can I make a collision does not rotate with image_angle

Z

zzs1339004604

Guest
I'm trying to make a dash like how celeste done,but when I close to the block and dash,it can't work,and if I reduce the collision it will be stuck in the block.

GML:
//    Update Horizontial Movement    //

if(!place_meeting(x + xSpeed,y,oBlockParent))
    x += xSpeed;
else
if(!place_meeting(x + sign(xSpeed),y,oBlockParent))
    x += sign(xSpeed);

//    Update Vertical Movement    //

if    (!place_meeting(x,y + ySpeed,oBlockParent))
{y += ySpeed;}
else
{
    move_contact_solid(point_direction(x,y,x,y + ySpeed),maxFallSpeed);
    ySpeed = 0;
}
 

TsukaYuriko

☄️
Forum Staff
Moderator
Use a different variable to handle rotation, and draw the sprite using that variable instead of image_angle, as changing image_angle will affect collisions no matter what.
 
Z

zzs1339004604

Guest
I'm a little confused about that adding a draw step to draw sprites that the sprites won't have collision?
Use a different variable to handle rotation, and draw the sprite using that variable instead of image_angle, as changing image_angle will affect collisions no matter what.
 

Nidoking

Member
The collision processing will be based on the instance's variables, such as image_angle, regardless of how the sprite is actually drawn.
 

FrostyCat

Redemption Seeker
This is what TsukaYuriko means by "use a different variable to handle rotation".

Create:
GML:
imageAngle = 0;
Draw:
GML:
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_blend, imageAngle);
Then instead of rotating the sprite with image_angle (which affects the mask), you rotate it with imageAngle (which only affects the drawn sprite).
 
Last edited by a moderator:
Z

zzs1339004604

Guest
Use a different variable to handle rotation, and draw the sprite using that variable instead of image_angle, as changing image_angle will affect collisions no matter what.
Thank you so much!I solve my problem:D
 
Top