K
_kingxjosh01
Guest
Hi there. So I started using this tutorial so I can get physics similar to SMB1 but I tried to run it and this happens:
ERROR in
action number 1
of Step Event0
for object obj_player:
Variable input.<unknown variable>(100010, -2147483648) not set before reading it.
at gml_Object_obj_player_Step_0 (line 4) - move = input.left + input.right;
############################################################################################
gml_Object_obj_player_Step_0 (line 4)
I looked over my variables in input and see nothing misspelled, at least that's what my eyes tell me haha.
My "input" Code:
Here's my "Step" code for obj_player:
Also another thing, Ga,meMaker 2 doesn't have "instance_create". Instead, it has "instance_create_depth" and "instance_create_layered" which one would I use for this and why? That could be why its not working right
Here's my obj_main "create" code:
The help would be much appreciated. Thanks beforehand if you read to this point.
Here's the tutorial if you'll would like to see it:
ERROR in
action number 1
of Step Event0
for object obj_player:
Variable input.<unknown variable>(100010, -2147483648) not set before reading it.
at gml_Object_obj_player_Step_0 (line 4) - move = input.left + input.right;
############################################################################################
gml_Object_obj_player_Step_0 (line 4)
I looked over my variables in input and see nothing misspelled, at least that's what my eyes tell me haha.
My "input" Code:
GML:
///Check for inputs
up = keyboard_check(vk_up);
down = keyboard_check(vk_down);
right = keyboard_check(vk_right);
left = - keyboard_check(vk_left);
start = keyboard_check(vk_enter);
select = keyboard_check(vk_tab);
a = keyboard_check(ord("A"));
b = keyboard_check(ord("S"));
Code:
/// Main Actions
// Movement
move = input.left + input.right;
// Move Right
if (move == 1)
{
hsp += acc;
if (hsp >= maxSpeed) hsp = maxSpeed;
}
else if (hsp > 0)
{
hsp -= acc;
if (hsp <= 0) hsp = 0;
}
// Move Left
if (move == -1)
{
hsp -= acc;
if (hsp <= -maxSpeed) hsp = -maxSpeed;
}
else if (hsp < 0)
{
hsp += acc;
if (hsp >= 0) hsp = 0;
}
// Gravity
if (vsp < 5) vsp += grav;
if (place_meeting(x, y+1, obj_wall)) vsp = 0;
x += hsp;
y += vsp;
Here's my obj_main "create" code:
Code:
/// Set input
instance_create_layer(x,y,1,input);
Here's the tutorial if you'll would like to see it: