S
ShilohPell
Guest
Hey guys. So I'm making my first platformer and I've run into a bit of a bug.
Desired behavior:
Current behavior:
Desired solution:
Current code:
Desired behavior:
My player's sprite should cycle through different sprites based on three states. Player in the air, player on the ground and moving, and player on the ground and idle. The in-air sprite needs to rotate as it follows the player through the air.
Current behavior:
The sprites cycle just as I want them to. The only issue is the in-air sprite's collision box rotates with it as the player's trajectory moves. Meaning when the player collides with a wall while jumping, the collision box cycles from an angled box to a square one and the player sticks to the wall instead of falling
Desired solution:
I need to replace my sprite_index assignment with another line that will allow me to either change the sprite angle without changing the collision box, or a way to draw the sprite in the step event at the desired angle while I apply a different sprite's collision mask.
Current code:
Code:
///Sprite Selection
if(collision_down) && (!move = 0) //If the player is touching the ground and pressing a movement key
{
sprite_index = spr_player_moving;
image_angle = 0;
image_speed = 1;
};
if(!collision_down) && (!collision_left) && (!collision_right) //If the player is in the air
{
sprite_index = spr_player_jumping;
image_angle = direction;
image_speed = 1;
};
if(collision_down) && (move = 0) //If the player is on the ground and not pressing a movement key
{
sprite_index = spr_player_idle;
image_angle = 0;
image_speed = 0.25;
};