Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Alright, here's the code I've done so far.

1.

hsp = 0;
vsp = 0;
grv = 0.3;
walksp = 4;

______

2.

//Get Player Input
key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);

//Calculate Movement
var move = key_right - key_left;

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;

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