• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Help for sprite crashing error? (total newbie)

S

ScionofLorelei

Guest
Hello everyone!

I'm pretty new to Game Maker, and I wasn't originally going to trouble anybody with this, but I just have to ask about an error that has been bothering me for a good few days. i've asked around, and many of the common fixes don't work. So I'm stumped.
I'm following Shaun Spalding's Action RPG tutorial

The issue is, when I run the game, the walking sprites for left, up, and down work fine, but after the sprite thread the right animation just causes the game to crash.

The fix is likely something really obvious- I'm an idiot XD but I still can't help but feel baffled over it

I ended up going for the original tutorial code and copying it out word for word, even doing full pastes, but the issue still persists, while the original code runs fine.

Anybody got an idea? ^^;
 

Attachments

TsukaYuriko

☄️
Forum Staff
Moderator
Please post code as code, not as images. We can't paste images into code editors. ;)
When you say that it causes the game to crash, exactly what does this entail?
 
S

ScionofLorelei

Guest
Please post code as code, not as images. We can't paste images into code editors. ;)
When you say that it causes the game to crash, exactly what does this entail?
Ah gotcha!!! Sorry, gimme a sec ^^
Sorry if i wasn't clear enough!! what I meant was that the other directions run okay, but after the first few frames of the walking right animation, the game window just crashes
not the entire program, just the game window
I have eight walking sprites, two for each direction. It comes up with the error X://windows/Runner.exe exited with non-zero status (-1073741819). I've already tried clearing the runtimes and cleaning the program- it still all comes down to the same error.

Step:


GML:
//Get Player Input
keyLeft = keyboard_check(vk_left) || keyboard_check(ord("A"));
keyRight = keyboard_check(vk_right) || keyboard_check(ord("D"));
keyUp = keyboard_check(vk_up) || keyboard_check(ord("W"));
keyDown = keyboard_check(vk_down) || keyboard_check(ord("S"));
keyActivate = keyboard_check_pressed(vk_space);
keyAttack = keyboard_check_pressed(vk_shift);
keyItem = keyboard_check_pressed(vk_control);

inputDirection = point_direction(0,0,keyRight-keyLeft,keyDown-keyUp);
inputMagnitude = (keyRight - keyLeft != 0) || (keyDown - keyUp != 0);

//Movement
hSpeed = lengthdir_x(inputMagnitude * speedWalk, inputDirection);
vSpeed = lengthdir_y(inputMagnitude * speedWalk, inputDirection);

x += hSpeed;
y += vSpeed;

//Update Sprite Index
var _oldSprite = sprite_index;
if (inputMagnitude != 0)
{
    direction = inputDirection
    sprite_index = NRun;
} else sprite_index = NIdle;


if (_oldSprite != sprite_index) localFrame = 0;

//Update Image Index
PlayerAnimateSprite();

Create:
GML:
image_speed = 0;
hSpeed = 0;
vSpeed = 0;
speedWalk = 5.0;

NRun = NeguRun;
NIdle = NeguIdle;
localFrame = 0;
Player Walk:

GML:
function PlayerAnimateSprite() {
    //Update Sprite
    var _cardinalDirection = round(direction/90); //floor(((direction div 45) + 1) * 0.5);

    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;



}
 

TsukaYuriko

☄️
Forum Staff
Moderator
If the game crashes without any error message, something has gone fundamentally wrong, potentially even before the game runs. There should be no circumstances under which no error message is thrown.

When you load the project into the IDE, what is the output in the console?
When you run the project from the IDE, what is the output in the console?

Please post both console logs. They may provide insight into what is happening.
 
S

ScionofLorelei

Guest
alright- if I understand what you mean, here's the console input
update: After running it this time around the game window got stuck on not responding for a bit 👌


Loading the project:

Verifying views...
No root view detected... automatically creating one
...done


Running:


Options: Z:/Attempt_2A925DF1\MainOptions.json
X://windows/Runner.exe -game "Y:/Attempt_3390B255_VM\Attempt.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Collision Event time(microsecs)=4
Total memory used = 7559706(0x00735a1a) bytes

X://windows/Runner.exe exited with non-zero status (-1073741819)
elapsed time 00:00:44.1122163s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.409/bin/Igor.exe" -j=8 -options="C:\Users\[redacted]\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run started at 02/08/2021 11:11:15
"cmd" /c subst Z: /d

elapsed time 00:00:00.0989416s for command "cmd" /c subst Z: /d started at 02/08/2021 11:12:00
"cmd" /c subst Y: /d

elapsed time 00:00:00.1389198s for command "cmd" /c subst Y: /d started at 02/08/2021 11:12:00
"cmd" /c subst X: /d

elapsed time 00:00:00.1249300s for command "cmd" /c subst X: /d started at 02/08/2021 11:12:00
FAILED: Run Program Complete
For the details of why this build failed, please review the whole log above and also see your Compile Errors window.


note: there's nothing in the compile errors window
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
There should be a lot more in the "running" log. Did you copy everything from the output window?
 
S

ScionofLorelei

Guest
oh wait- sorry!!! yes, this is everything in the output window


"cmd" /c subst Z: "C:\Users\-\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE"

elapsed time 00:00:00.0739570s for command "cmd" /c subst Z: "C:\Users\-\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE" started at 02/08/2021 11:22:34
"cmd" /c subst Y: "C:\Users\-\AppData\Local\GameMakerStudio2\GMS2TEMP"

elapsed time 00:00:00.1069388s for command "cmd" /c subst Y: "C:\Users\-\AppData\Local\GameMakerStudio2\GMS2TEMP" started at 02/08/2021 11:22:34
"cmd" /c subst X: "C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.3.1.409"

elapsed time 00:00:00.1049400s for command "cmd" /c subst X: "C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.3.1.409" started at 02/08/2021 11:22:34
"C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.409/bin/Igor.exe" -j=8 -options="C:\Users\-\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run

Loaded Macros from C:\Users\-\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE\Attempt_2A925DF1\macros.json
Options: X:/bin\platform_setting_defaults.json
Options: C:\Users\-\AppData\Roaming/GameMakerStudio2\g_2918309944\local_settings.json
Failed to load Options from C:\Users\-\AppData\Roaming/GameMakerStudio2\g.morgan_2918309944\local_settings.json
Options: C:\Users\-\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE\Attempt_2A925DF1\targetoptions.json
Setting up the Asset compiler
X://bin/GMAssetCompiler.exe /c /mv=1 /zpex /iv=0 /rv=0 /bv=0 /j=8 /gn="Attempt" /td="Y:/" /cd="Z:/Attempt_2A925DF1" /zpuf="C:\Users\-\AppData\Roaming/GameMakerStudio2\g_2918309944" /m=windows /tgt=64 /nodnd /cfg="Default" /o="Y:/Attempt_241251E9_VM" /sh=True /optionsini="Y:/Attempt_241251E9_VM\options.ini" /cvm /baseproject="X:/BaseProject\BaseProject.yyp" "C:\Users\-\OneDrive\Documents\Darkstar\New Game\Attempt.yyp" /preprocess="Z:/Attempt_2A925DF1"
We have a Zeus Project!
Found Project Format 2
ProjectFileWatcher:StartWatching:C:\Users\-\OneDrive\Documents\Darkstar\New Game
Started: 08/02/2021 11:22:36
Finished: 08/02/2021 11:22:37
Diff: 00:00:01.3450853
Loaded Project: Attempt
finished.
Release build
Options: Z:/Attempt_2A925DF1\ExtensionOptions.json
OptionsIni
Options: Z:/Attempt_2A925DF1\PlatformOptions.json
[Compile] Run asset compiler
X://bin/GMAssetCompiler.exe /c /mv=1 /zpex /iv=0 /rv=0 /bv=0 /j=8 /gn="Attempt" /td="Y:/" /cd="Z:/Attempt_2A925DF1" /zpuf="C:\Users\-\AppData\Roaming/GameMakerStudio2\g_2918309944" /m=windows /tgt=64 /nodnd /cfg="Default" /o="Y:/Attempt_241251E9_VM" /sh=True /optionsini="Y:/Attempt_241251E9_VM\options.ini" /cvm /baseproject="X:/BaseProject\BaseProject.yyp" "C:\Users\-\OneDrive\Documents\Darkstar\New Game\Attempt.yyp" /bt=run /rt=vm /64bitgame=false
Compile Constants...finished.
Remove DnD...finished.
Compile Scripts...finished.
Compile Rooms...finished.
Compile Objects...finished.
Compile Timelines...finished.
Compile Triggers...finished.
Compile Extensions...finished.
Global scripts...finished.
finished.
collapsing enums.
Final Compile...finished.
Saving IFF file... Y:/Attempt_241251E9_VM\Attempt.win
Writing Chunk... GEN8
option_game_speed=60
Writing Chunk... OPTN
Writing Chunk... LANG
Writing Chunk... EXTN
Writing Chunk... SOND
Writing Chunk... AGRP
Writing Chunk... SPRT
Writing Chunk... BGND
Writing Chunk... PATH
Writing Chunk... SCPT
Writing Chunk... GLOB
Writing Chunk... SHDR
Writing Chunk... FONT
Writing Chunk... TMLN
Writing Chunk... OBJT
Writing Chunk... ACRV
Writing Chunk... SEQN
Writing Chunk... TAGS
Writing Chunk... ROOM
Writing Chunk... DAFL
Writing Chunk... EMBI
Writing Chunk... TPAGE
Texture Group - Default
Writing Chunk... TGIN
Writing Chunk... CODE
Writing Chunk... VARI
Writing Chunk... FUNC
Writing Chunk... STRG
Writing Chunk... TXTR
0 Compressing texture... writing texture texture_0.png...
Writing Chunk... AUDO
Writing Chunk... SCPT
Writing Chunk... DBGI
Writing Chunk... INST
Writing Chunk... LOCL
Writing Chunk... DFNC
Writing Chunk... STRG
Stats : GMA : Elapsed=1896.1326
Stats : GMA : sp=2,au=0,bk=0,pt=0,sc=3,sh=0,fo=0,tl=0,ob=1,ro=1,da=0,ex=0,ma=4,fm=0x220440000020
DoSteam
Igor complete.
[Run] Run game
Options: Z:/Attempt_2A925DF1\MainOptions.json
X://windows/Runner.exe -game "Y:/Attempt_241251E9_VM\Attempt.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Collision Event time(microsecs)=24
Total memory used = 7559706(0x00735a1a) bytes
**********************************.
Entering main loop.
**********************************.


X://windows/Runner.exe exited with non-zero status (-1073741819)
elapsed time 00:00:09.8857758s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.409/bin/Igor.exe" -j=8 -options="C:\Users\-\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run started at 02/08/2021 11:22:34
"cmd" /c subst Z: /d

elapsed time 00:00:00.0959450s for command "cmd" /c subst Z: /d started at 02/08/2021 11:22:44
"cmd" /c subst Y: /d

elapsed time 00:00:00.1179318s for command "cmd" /c subst Y: /d started at 02/08/2021 11:22:44
"cmd" /c subst X: /d

elapsed time 00:00:00.1069374s for command "cmd" /c subst X: /d started at 02/08/2021 11:22:45
FAILED: Run Program Complete
For the details of why this build failed, please review the whole log above and also see your Compile Errors window.
 
S

ScionofLorelei

Guest
Could you put show_debug_message(string(localFrame)) after this line to see what values you get, particularly the last value before it crashes?

Is the debug message in the console? nothing's changed in the actual game window

This is what came up after I ran it
pretty much the same thing aside from the zeroes


"cmd" /c subst Z: "C:\Users\\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE"

elapsed time 00:00:00.0739572s for command "cmd" /c subst Z: "C:\Users\\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE" started at 02/08/2021 11:55:16
"cmd" /c subst Y: "C:\Users\\AppData\Local\GameMakerStudio2\GMS2TEMP"

elapsed time 00:00:00.0879484s for command "cmd" /c subst Y: "C:\Users\\AppData\Local\GameMakerStudio2\GMS2TEMP" started at 02/08/2021 11:55:16
"cmd" /c subst X: "C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.3.1.409"

elapsed time 00:00:00.1009408s for command "cmd" /c subst X: "C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.3.1.409" started at 02/08/2021 11:55:16
"C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.409/bin/Igor.exe" -j=8 -options="C:\Users\\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run

Loaded Macros from C:\Users\\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE\Attempt_2A925DF1\macros.json
Options: X:/bin\platform_setting_defaults.json
Options: C:\Users\\AppData\Roaming/GameMakerStudio2\g_2918309944\local_settings.json
Failed to load Options from C:\Users\\AppData\Roaming/GameMakerStudio2\g_2918309944\local_settings.json
Options: C:\Users\\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE\Attempt_2A925DF1\targetoptions.json
Setting up the Asset compiler
X://bin/GMAssetCompiler.exe /c /mv=1 /zpex /iv=0 /rv=0 /bv=0 /j=8 /gn="Attempt" /td="Y:/" /cd="Z:/Attempt_2A925DF1" /zpuf="C:\Users\elshi\AppData\Roaming/GameMakerStudio2\g_2918309944" /m=windows /tgt=64 /nodnd /cfg="Default" /o="Y:/Attempt_73DBF722_VM" /sh=True /optionsini="Y:/Attempt_73DBF722_VM\options.ini" /cvm /baseproject="X:/BaseProject\BaseProject.yyp" "C:\Users\\OneDrive\Documents\Darkstar\New Game\Attempt.yyp" /preprocess="Z:/Attempt_2A925DF1"
We have a Zeus Project!
Found Project Format 2
ProjectFileWatcher:StartWatching:C:\Users\\OneDrive\Documents\Darkstar\New Game
Started: 08/02/2021 11:55:18
Finished: 08/02/2021 11:55:19
Diff: 00:00:01.3462293
Loaded Project: Attempt
finished.
Release build
Options: Z:/Attempt_2A925DF1\ExtensionOptions.json
OptionsIni
Options: Z:/Attempt_2A925DF1\PlatformOptions.json
[Compile] Run asset compiler
X://bin/GMAssetCompiler.exe /c /mv=1 /zpex /iv=0 /rv=0 /bv=0 /j=8 /gn="Attempt" /td="Y:/" /cd="Z:/Attempt_2A925DF1" /zpuf="C:\Users\elshi\AppData\Roaming/GameMakerStudio2\g_2918309944" /m=windows /tgt=64 /nodnd /cfg="Default" /o="Y:/Attempt_73DBF722_VM" /sh=True /optionsini="Y:/Attempt_73DBF722_VM\options.ini" /cvm /baseproject="X:/BaseProject\BaseProject.yyp" "C:\Users\OneDrive\Documents\Darkstar\New Game\Attempt.yyp" /bt=run /rt=vm /64bitgame=false
Compile Constants...finished.
Remove DnD...finished.
Compile Scripts...finished.
Compile Rooms...finished.
Compile Objects...finished.
Compile Timelines...finished.
Compile Triggers...finished.
Compile Extensions...finished.
Global scripts...finished.
finished.
collapsing enums.
Final Compile...finished.
Saving IFF file... Y:/Attempt_73DBF722_VM\Attempt.win
Writing Chunk... GEN8
option_game_speed=60
Writing Chunk... OPTN
Writing Chunk... LANG
Writing Chunk... EXTN
Writing Chunk... SOND
Writing Chunk... AGRP
Writing Chunk... SPRT
Writing Chunk... BGND
Writing Chunk... PATH
Writing Chunk... SCPT
Writing Chunk... GLOB
Writing Chunk... SHDR
Writing Chunk... FONT
Writing Chunk... TMLN
Writing Chunk... OBJT
Writing Chunk... ACRV
Writing Chunk... SEQN
Writing Chunk... TAGS
Writing Chunk... ROOM
Writing Chunk... DAFL
Writing Chunk... EMBI
Writing Chunk... TPAGE
Texture Group - Default
Writing Chunk... TGIN
Writing Chunk... CODE
Writing Chunk... VARI
Writing Chunk... FUNC
Writing Chunk... STRG
Writing Chunk... TXTR
0 Compressing texture... writing texture texture_0.png...
Writing Chunk... AUDO
Writing Chunk... SCPT
Writing Chunk... DBGI
Writing Chunk... INST
Writing Chunk... LOCL
Writing Chunk... DFNC
Writing Chunk... STRG
Stats : GMA : Elapsed=2679.2498
Stats : GMA : sp=2,au=0,bk=0,pt=0,sc=3,sh=0,fo=0,tl=0,ob=1,ro=1,da=0,ex=0,ma=4,fm=0x220440040020
DoSteam
Igor complete.
[Run] Run game
Options: Z:/Attempt_2A925DF1\MainOptions.json
X://windows/Runner.exe -game "Y:/Attempt_73DBF722_VM\Attempt.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Collision Event time(microsecs)=9
Total memory used = 7559894(0x00735ad6) bytes
**********************************.
Entering main loop.
**********************************.
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-0.00


X://windows/Runner.exe exited with non-zero status (-1073741819)
elapsed time 00:00:11.3332972s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.409/bin/Igor.exe" -j=8 -options="C:\Users\elshi\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run started at 02/08/2021 11:55:17
"cmd" /c subst Z: /d

elapsed time 00:00:00.0939434s for command "cmd" /c subst Z: /d started at 02/08/2021 11:55:28
"cmd" /c subst Y: /d

elapsed time 00:00:00.1049414s for command "cmd" /c subst Y: /d started at 02/08/2021 11:55:28
"cmd" /c subst X: /d

elapsed time 00:00:00.1049391s for command "cmd" /c subst X: /d started at 02/08/2021 11:55:28
FAILED: Run Program Complete
For the details of why this build failed, please review the whole log above and also see your Compile Errors window.
 

Nidoking

Member
Yes, but notice that the last one is showing as -0.00. I think that's the answer. You're getting close enough to the whole frame number that the check triggers, but the subtraction results in a negative number that rounds to zero, which isn't a valid frame index. Maybe see what effect localFrame = max(localFrame, 0) has.
 
S

ScionofLorelei

Guest
ah got it ^^ thankyou-

just tried it, and this is what it says?
Just went back through and checked the spelling of the variable. It's the same-




___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object negu_0:

Variable negu_0.localFrame(100009, -2147483648) not set before reading it.
at gml_Object_negu_0_Create_0 (line 8) - localFrame = max(localFrame, 0)
############################################################################################
gml_Object_negu_0_Create_0 (line 8)



UPDATE: tried this to set the variable again instead of replacing the original line
localFrame = 0;
localFrame = max 0(localFrame)


it gives a different error

___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object negu_0:

camera_create() - doesn't take any arguments
at gml_Object_negu_0_Create_0 (line 9) - localFrame = max 0(localFrame)
############################################################################################
gml_Object_negu_0_Create_0 (line 9)
 
Last edited by a moderator:
Top