ItsYerBoiWintah
Member
Hi, i just started using game maker, very uneducated in it but im trying to learn, and follow along with a tutorial for a game i want to make myself (using the tutorial to learn). I have followed everything done in this video
(
) and as far as im aware, my scripts are identical to his, but for some reason they arent working, i will post them down below
For the player:
"switch (state)
{
case "move":
#region move state
if keyboard_check(vk_right) and not place_meeting(x+4, y, o_wall) X
{
x += 4; <-------------------- in the tutorial he puts the name of this script on this line
image_xscale = 1;
sprite_index = s_skeleton_run_strip6;
image_speed = 0.6;
}
if keyboard_check(vk_left) and not place_meeting(x-4, y, o_wall)
{
x -=4; <-------------------- in the tutorial he puts the name of this script on this line as well
image_xscale = -1;
sprite_index = s_skeleton_run_strip6;
image_speed = 0.6;
}
if not keyboard_check(vk_right) and not keyboard_check(vk_left)
{
sprite_index = s_skeleton_idle_strip3;
image_speed = 0.4;
}
if keyboard_check_pressed(vk_space)
{
image_index = 0;
state = "roll";
}
if keyboard_check_pressed(vk_lshift)
{
image_index = 0;
state = "attack one"
}
#endregion
break;
case "roll":
#region roll state
sprite_index = s_skeleton_roll_strip7;
image_speed = 0.6;
if image_xscale == 1 and not place_meeting(x+4, y, o_wall)
{
x += 6;
}
if image_xscale == -1 and not place_meeting(x-4, y, o_wall)
{
x -= 6;
}
#endregion
break;
case "attack one":
#region attack one state
sprite_index = s_skeleton_attack_one_strip5
image_speed = 0.6
#endregion
break;
}"
And for the script:
"if not place_meeting(x+argument0, y, o_wall)
{
x += argument0;
}
if not place_meeting(x, y+argument0, o_wall)
{
y += argument1;
}"
AND NOW for my error message:
"############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:
Variable <unknown_object>.y(1, -2147483648) not set before reading it.
at gml_GlobalScript_Script1 (line 1) - if not place_meeting(x+argument0, y, o_wall) <------------------------------------------- like its not picking up my y variable, ive also tried position_meeting but that doesnt work either
############################################################################################
gml_GlobalScript_Script1 (line 1)"
Please, help me!
(
For the player:
"switch (state)
{
case "move":
#region move state
if keyboard_check(vk_right) and not place_meeting(x+4, y, o_wall) X
{
x += 4; <-------------------- in the tutorial he puts the name of this script on this line
image_xscale = 1;
sprite_index = s_skeleton_run_strip6;
image_speed = 0.6;
}
if keyboard_check(vk_left) and not place_meeting(x-4, y, o_wall)
{
x -=4; <-------------------- in the tutorial he puts the name of this script on this line as well
image_xscale = -1;
sprite_index = s_skeleton_run_strip6;
image_speed = 0.6;
}
if not keyboard_check(vk_right) and not keyboard_check(vk_left)
{
sprite_index = s_skeleton_idle_strip3;
image_speed = 0.4;
}
if keyboard_check_pressed(vk_space)
{
image_index = 0;
state = "roll";
}
if keyboard_check_pressed(vk_lshift)
{
image_index = 0;
state = "attack one"
}
#endregion
break;
case "roll":
#region roll state
sprite_index = s_skeleton_roll_strip7;
image_speed = 0.6;
if image_xscale == 1 and not place_meeting(x+4, y, o_wall)
{
x += 6;
}
if image_xscale == -1 and not place_meeting(x-4, y, o_wall)
{
x -= 6;
}
#endregion
break;
case "attack one":
#region attack one state
sprite_index = s_skeleton_attack_one_strip5
image_speed = 0.6
#endregion
break;
}"
And for the script:
"if not place_meeting(x+argument0, y, o_wall)
{
x += argument0;
}
if not place_meeting(x, y+argument0, o_wall)
{
y += argument1;
}"
AND NOW for my error message:
"############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:
Variable <unknown_object>.y(1, -2147483648) not set before reading it.
at gml_GlobalScript_Script1 (line 1) - if not place_meeting(x+argument0, y, o_wall) <------------------------------------------- like its not picking up my y variable, ive also tried position_meeting but that doesnt work either
############################################################################################
gml_GlobalScript_Script1 (line 1)"
Please, help me!