S
SkullFantasyFortress!
Guest
So, I've been following a tutorial on how to build a basic beat em up game. I am currently stuck at the steps regarding attacking and movement, where I always receive this message upon testing.
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object Riege_Player:
Variable Riege_Player.A(100013, -2147483648) not set before reading it.
at gml_Object_Riege_Player_Step_0 (line 3) - }if(keyboard_check(ord(A)))
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_Riege_Player_Step_0 (line 3)
Here is my entire code.
if(CurrentHP > 0){
XSpeed = 0;
}if(keyboard_check(ord(A)))
{
XSpeed = -1*Speed;
}else if(keyboard_check(ord(D))){//Checks if either the W or S buttons are pressed to make the player move Up or Down.
YSpeed = 0;
if(OnGround == true){
if(keyboard_check(ord(W))){if(IsAttacking == false && I = false){
//If the player is on the ground move them with XSpeed and YSpeed, otherwise ignore YSpeedif(OnGround==true){
if(XSpeed != 0 && YSpeed != 0){
x+=XSpeed*SpeedMod*.7;
y+=YSpeed*SpeedMod*.7;
}else if(XSpeed != 0 || YSpeed != 0){
x+=XSpeed*SpeedMod;
y+=YSpeed*SpeedMod;
}
}else if(OnGround == false ){
x+=XSpeed*SpeedMod;
}
if(XSpeed != 0){
image_xscale = sign(XSpeed*SpeedMod);
}
//Animates the Player based on their speed
if(XSpeed == 0 && YSpeed == 0 && OnGround == true){
SpeedMod = 1;
sprite_index = SPR_PlayerIdle;
}else if((XSpeed!=0 || YSpeed != 0) && sprite_index!=SPR_PlayerWalking && OnGround == true){
sprite_index = SPR_PlayerWalking;
}
}
YSpeed = -1*Speed;
}else if(keyboard_check(ord(S))){//If the player is on the ground, this sets their GroundY variable to their current y position
if(OnGround == true){
GroundY = y;
}
//Sets the Players' depth based on their GroundY. We're using GroundY instead of y so that even when they're in the air, they will display in fornt of and behind the right objects.
depth = -1*GroundY;
YSpeed = Speed;
}
}
XSpeed = Speed;
instance_destroy();
{}
Please, can someone tell me where i'm going wrong?
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object Riege_Player:
Variable Riege_Player.A(100013, -2147483648) not set before reading it.
at gml_Object_Riege_Player_Step_0 (line 3) - }if(keyboard_check(ord(A)))
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_Riege_Player_Step_0 (line 3)
Here is my entire code.
if(CurrentHP > 0){
XSpeed = 0;
}if(keyboard_check(ord(A)))
{
XSpeed = -1*Speed;
}else if(keyboard_check(ord(D))){//Checks if either the W or S buttons are pressed to make the player move Up or Down.
YSpeed = 0;
if(OnGround == true){
if(keyboard_check(ord(W))){if(IsAttacking == false && I = false){
//If the player is on the ground move them with XSpeed and YSpeed, otherwise ignore YSpeedif(OnGround==true){
if(XSpeed != 0 && YSpeed != 0){
x+=XSpeed*SpeedMod*.7;
y+=YSpeed*SpeedMod*.7;
}else if(XSpeed != 0 || YSpeed != 0){
x+=XSpeed*SpeedMod;
y+=YSpeed*SpeedMod;
}
}else if(OnGround == false ){
x+=XSpeed*SpeedMod;
}
if(XSpeed != 0){
image_xscale = sign(XSpeed*SpeedMod);
}
//Animates the Player based on their speed
if(XSpeed == 0 && YSpeed == 0 && OnGround == true){
SpeedMod = 1;
sprite_index = SPR_PlayerIdle;
}else if((XSpeed!=0 || YSpeed != 0) && sprite_index!=SPR_PlayerWalking && OnGround == true){
sprite_index = SPR_PlayerWalking;
}
}
YSpeed = -1*Speed;
}else if(keyboard_check(ord(S))){//If the player is on the ground, this sets their GroundY variable to their current y position
if(OnGround == true){
GroundY = y;
}
//Sets the Players' depth based on their GroundY. We're using GroundY instead of y so that even when they're in the air, they will display in fornt of and behind the right objects.
depth = -1*GroundY;
YSpeed = Speed;
}
}
XSpeed = Speed;
instance_destroy();
{}
Please, can someone tell me where i'm going wrong?