• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

New sprite wont move

H

Hyperball

Guest
So i made a new payer sprite, but now the code that is used to move the player wont react, it also seems that the player is wedged with the floor for some reason...
 
H

Hyperball

Guest
Can you show the code?
Is the sprite origin correct and doesn't make the player spawn or get stuck inside the ground?
It a lot, but i copied everythin just in case, also, the origin is in the center, i also checked the collision mask, but that not a problem as wel...

//Get Player Input

if (hascontrol)
{
key_left = keyboard_check_direct(vk_left) || keyboard_check(ord("A"));
key_right = keyboard_check_direct(vk_right) || keyboard_check(ord("D"));
key_jump = keyboard_check_pressed(vk_space) || keyboard_check(ord("W"));
}
else
{
key_right = 0;
key_left = 0;
key_jump = 0;
}

//Calculate Movement
var move = key_left + key_right;

hsp = move * walksp;

vsp = vsp + grv

if (place_meeting(x,y+1,oWall)) && (key_jump)
{
vsp = -7;
}
//Horizontal Collision
if (place_meeting(x+hsp,y,oWall))
{
while(!place_meeting(x+sign(hsp),y,oWall))
{
x = x + sign(hsp);
}
hsp = 0;
}

x = x + hsp;

//VerticalCollision
if (place_meeting(x,y+vsp, oWall))
{
while(!place_meeting(x,y+sign(vsp),oWall))
{
y = y + sign(vsp);
}
vsp = 0;
}

y = y + vsp;


//Animation
if (!place_meeting(x,y+1,oWall))
{

sprite_index = sPlayerA;
image_speed = 0;
if (sign(vsp) > 0) image_index = 1; else image_index = 0;
}
else
{
image_speed = 1;
if (hsp == 0)
{
sprite_index = sPlayer;
}
else
{
sprite_index = sPlayerR;
}
}
if (hsp != 0) image_xscale = sign(hsp)
 
H

Hyperball

Guest
It being set to true is correct.
Does the player spawn in the ground? It looks to me like he's stuck. Go into the room editor and push the player object a bit upwards.
i already set him about really high into the sky, still nothing...
 
H

Hyperball

Guest
and when i move in mid-air and land, the player sprite is really thin
 
D

Deanaro

Guest
it could be that the different sprites you are using have different collision masks
 
Top