H
Helpmeplzimdying
Guest
Howdy!
I'm having trouble understanding what's happening with my code.
So, I got this error message:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object ob_player:
Variable ob_player.phy_position_x(55, -2147483648) not set before reading it.
at gml_Script_scr_move_state (line 29) - phy_position_x += hspd;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_move_state (line 29)
called from - gml_Object_ob_player_StepNormalEvent_1 (line 2) - script_execute(state);
And I'm not sure what's wrong with my own code for movement:
///scr_move_state
spd = 2.25;
scr_get_input();
//Speedwalk
if (M_key) {
spd = 3;
}
// Get the axis
var xaxis = (D_key - A_key);
var yaxis = (S_key - W_key);
//Get direction
var dir = point_direction(0,0, xaxis, yaxis);
//Get length
if (xaxis == 0 and yaxis = 0) {
len = 0;
} else {
len = spd;
}
//Hspd and Vspd
hspd = lengthdir_x(len,dir)*spd;
vspd = lengthdir_y(len,dir)*spd;
//Move
phy_position_x += hspd;
phy_position_y += vspd;
// Control Sprite
image_speed = sign(len)*.1
if (len == 0) image_index = 0;
// Vertical Sprites
if (vspd > 0) {
sprite_index = player_down;
} else if (vspd <0) {
sprite_index = player_up;
}
//Horizontal Sprites
if (hspd > 0) {
sprite_index = player_right;
} else if (hspd < 0) {
sprite_index = player_left;
}
//Speedwalk sprite
if (M_key) {
image_speed = sign(len)*.2
}
This only happens when I try to move to the next room.
I'm currently following a HeartBeast RPG Tutorial at the moment, and I checked over it
I did copy it correctly, I believe
Would someone help? Thanks if you do!
I'm having trouble understanding what's happening with my code.
So, I got this error message:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object ob_player:
Variable ob_player.phy_position_x(55, -2147483648) not set before reading it.
at gml_Script_scr_move_state (line 29) - phy_position_x += hspd;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_move_state (line 29)
called from - gml_Object_ob_player_StepNormalEvent_1 (line 2) - script_execute(state);
And I'm not sure what's wrong with my own code for movement:
///scr_move_state
spd = 2.25;
scr_get_input();
//Speedwalk
if (M_key) {
spd = 3;
}
// Get the axis
var xaxis = (D_key - A_key);
var yaxis = (S_key - W_key);
//Get direction
var dir = point_direction(0,0, xaxis, yaxis);
//Get length
if (xaxis == 0 and yaxis = 0) {
len = 0;
} else {
len = spd;
}
//Hspd and Vspd
hspd = lengthdir_x(len,dir)*spd;
vspd = lengthdir_y(len,dir)*spd;
//Move
phy_position_x += hspd;
phy_position_y += vspd;
// Control Sprite
image_speed = sign(len)*.1
if (len == 0) image_index = 0;
// Vertical Sprites
if (vspd > 0) {
sprite_index = player_down;
} else if (vspd <0) {
sprite_index = player_up;
}
//Horizontal Sprites
if (hspd > 0) {
sprite_index = player_right;
} else if (hspd < 0) {
sprite_index = player_left;
}
//Speedwalk sprite
if (M_key) {
image_speed = sign(len)*.2
}
This only happens when I try to move to the next room.
I'm currently following a HeartBeast RPG Tutorial at the moment, and I checked over it
I did copy it correctly, I believe
Would someone help? Thanks if you do!