Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Hi been following long just the beginning of the series on episode 2 (part 2: Animation) of this series. The scripted is causing an error code.

############################################################################################
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)

I have written the code twice to make sure if the mistake was on my end, and every word matches the video. If anyone can point me in the right direction or give me some understanding what going on. Anything would be helpful

Deleted 3 years ago
(+1)

Thanks, I had the same problem and this solved it.

TL;DR  wrap the script code for PlayerAnimationSprite in a function called: function PlayerAnimationSprite( ) { .... }

Can you explain further. This will help a lot

How?

For other people struggling with this, scripts changed in 2.3 and have to work differently. The source code will work as GameMaker will convert the scripts to the new style.

I have made a video explaining this issue: