Skip to main content

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

I like the screenshot, don't forsake. Maybe it's time to comment your code or clean your code if you haven't did it before. It can't be more useful that you could think.

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;