K
kiyogity
Guest
Hello, I am completely new to programming and I tried following along with this tutorial to make my first game. However when I run my game I get a syntax error.
ERROR in
action number 1
of Step Event0
for object obj_Bat:
Variable obj_Bat.go(100003, -2147483648) not set before reading it.
at gml_Object_obj_Bat_Step_0 (line 28) - if !go x = other.x;
############################################################################################
gml_Object_obj_Bat_Step_0 (line 28)
______
This is my code here:
ERROR in
action number 1
of Step Event0
for object obj_Bat:
Variable obj_Bat.go(100003, -2147483648) not set before reading it.
at gml_Object_obj_Bat_Step_0 (line 28) - if !go x = other.x;
############################################################################################
gml_Object_obj_Bat_Step_0 (line 28)
______
This is my code here:
Code:
/// @description Move
if keyboard_check(vk_left) // Check for the left qrrow key being held down
{
// This check is to make sure the bat doesn't go out of the room to the left
if x > sprite_get_xoffset(sprite_index) + spd
{
x -= spd; //Move the bat
}
else
{
x = sprite_get_xoffset(sprite_index); // Clamp the bat to the leftmost side
}
}
if keyboard_check(vk_right) // Check for the right arrow key being held down
{
// This check is to make sure the bat doesn't go out of the room to the right
if x < room_width - sprite_get_xoffset(sprite_index) - spd
{
x += spd;
}
else
{
x = room_width - sprite_get_xoffset(sprite_index);
}
}
// Moves the ball object w the bat if the ball isn't moving yet w (obj_ball)
{
if !go x = other.x;
}