S
snesicepuppy
Guest
Hey guys! First time user here, I've been watching Shaun Spalding's tutorial on making a platformed, so far everything has gone well, I copied almost exactly what the narrator, the only thing I changed was the name of my objects but for some reason I get the error code
Here is what I put in my code
Can anyone explain what I'm doing wrong in the most simple way possible?
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_player:
Variable obj_player.jumpspeed(100011, -2147483648) not set before reading it.
at gml_Object_obj_player_StepNormalEvent_1 (line 13) - vsp = key_jump * -jumpspeed
############################################################################################
Code:
//Get the player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);
//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;
if (place_meeting(x,y+1,obj_ground))
{
vsp = key_jump * -jumpspeed
}
//Horizontal Collision
if (place_meeting(x+hsp,y,obj_ground))
{
while(!place_meeting(x+sign(hsp),y,obj_ground))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;
//Vertical Collision
if (place_meeting(x,y+vsp,obj_ground))
{
while(!place_meeting(x,y+sign(vsp),obj_ground))
{
y += sign(vsp);
}
vsp = 0;
}
y += vsp;