M
Maefiosa
Guest
This is the code I was trying to do:
//UPDATE SPRITE
var _cardinalDirection = round(direction/90);
var _totalFrames = sprite_get_number(sprite_index) / 4;
image_index = localFrame + (_cardinalDirection * _totalFrames);
localFrame += sprite_get_speed(sprite_index) / FRAME_RATE;
//IF ANIMATION WOULD LOOP ON NEXT GAME STEP
if (localFrame >= _totalFrames)
{
animationEnd = true;
localFrame -= _totalFrames;
}else animationEnd = false;
When I tried to play the game to see if it was working like in the tutorial, it sent the following message:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:
Variable <unknown_object>.direction(8, -2147483648) not set before reading it.
at gml_GlobalScript_PlayerAnimateSprite (line 2) - var _cardinalDirection = round(direction/90);
############################################################################################
gml_GlobalScript_PlayerAnimateSprite (line 2)
Can someone please help? I do not understand what happened, I followed Shaun's Action RPG Tutorial until the second part, where this problem came from.
//UPDATE SPRITE
var _cardinalDirection = round(direction/90);
var _totalFrames = sprite_get_number(sprite_index) / 4;
image_index = localFrame + (_cardinalDirection * _totalFrames);
localFrame += sprite_get_speed(sprite_index) / FRAME_RATE;
//IF ANIMATION WOULD LOOP ON NEXT GAME STEP
if (localFrame >= _totalFrames)
{
animationEnd = true;
localFrame -= _totalFrames;
}else animationEnd = false;
When I tried to play the game to see if it was working like in the tutorial, it sent the following message:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:
Variable <unknown_object>.direction(8, -2147483648) not set before reading it.
at gml_GlobalScript_PlayerAnimateSprite (line 2) - var _cardinalDirection = round(direction/90);
############################################################################################
gml_GlobalScript_PlayerAnimateSprite (line 2)
Can someone please help? I do not understand what happened, I followed Shaun's Action RPG Tutorial until the second part, where this problem came from.