I got a HUGE problem with setting up my sprites in Game Maker. It just won't work properly!
I got these sprites of my main character.
A 16x16 mask
Idle right
Idle left
Attacking left
Attacking right
These are the masks and sprite combinations i've tried:
MasksSpritesI've centered every sprite using the "Center" button and i use automatic bounding box.
First i tried to do #1, this would give me plenty of room for animation. But as soon as i launched the game the player bounces of the ground indefinetly. Since i don't need any space below the sprite, i cut the canvas to #2. This fixed the problem with ground collisions, but when i jump onto the ceiling the sprite will move (jerk/lag) a few pixels without a reason!
#3 works fine, but i have no room for my animation!
I guess i could use sprites of different sizes and then adjust the y-offsett with some code, but i still want to get this to work properly! When i do "sprite_index = attack_left" or "sprite_index = walk_right" there should be NO offset and NO collision errors.
My collision code is taken from "The Novice & Intermediate F A Q" from the GMC.
STEP//check if on the ground
var block_below, block_standon, plat_below, plat_standon, on_ground;
block_below = collision_line(bbox_left+2,bbox_bottom+1,bbox_right-2,bbox_bottom+1,o_parent_block,true,true);
block_standon = (block_below >= 0) && !place_meeting(x,y,block_below);
on_ground = (vspeed == 0) && (block_standon);
Collision with blockif (bbox_bottom-vspeed <= other.bbox_top)
{
y = other.bbox_top-sprite_get_height(mask_index)+sprite_get_yoffset(mask_index);
vspeed = 0;
}
else if (bbox_top-vspeed >= other.bbox_bottom)
{
y = other.bbox_bottom+sprite_get_yoffset(mask_index)+1;
vspeed = 0;
}
I just can't see what i'm doing wrong. Everything is positioned the same in the center, the mask is always the same.
IT SHOULD WORK, I'M LOOSING MY MIND AND I SHOULD HAVE GONE TO BED 3HOURS AGO
(By the way, i know about the xscale command, but as soon as i used it my side collsions did not work properly! I could sometimes move 1px into the wall, but when i use two sprites it works perfectly)