• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Game doesn't run when I add a new object.

K

KulDud

Guest
Hello! This is my first GMS2 project, so be patient with me please!

I have a problem when I add a new object to my room. It doesn't have any code, this is the only code I have in my program:
gms1.png

It creates these tiles on a grid, and without the extra object everything works fine.
Here's the screenshot of the room:
gms2.png

And here's what the program says after building:
gms3.png Please help!

EDIT: Ok small update! I deleted all of that code from image 1 temporarily, and the program runs normally. So it HAS to be something with the code, and I still have no clue what. Maybe GMS 2 can't handle spawning many objects at once? No idea, I still need help :p
 
Last edited by a moderator:
Do not post screenshots of code or output. That is one of the first guidelines of the forum. Copy and paste the Output into code tags in a post. Using code tags is also in the guidelines. It makes it easier for people to check info as screenshots are not always clear to see.

Aside from that, where is the FAILED bit now? Does it immediately fail, or does it now just seem to freeze and never run?
 
K

KulDud

Guest
Do not post screenshots of code or output. That is one of the first guidelines of the forum. Copy and paste the Output into code tags in a post. Using code tags is also in the guidelines. It makes it easier for people to check info as screenshots are not always clear to see.

Aside from that, where is the FAILED bit now? Does it immediately fail, or does it now just seem to freeze and never run?
Oh, sorry. It seems to freeze and never run, yes.
 
My initial thought is that the problem is with your objTile, because each objTile instance on Game Start is creating a load of other objTiles instances which might also detect that it is still in Game Start and then each one of those instances creates multiple objTiles instances, etc, etc.
That would be an eternal loop which the game would never get out of and it probably would just crash after a while as all of your memory is consumed.
You should not have the objTile creating more objTiles instances. Try replacing this:
Code:
instance_create_layer(objGrid.x - 261 + x_spawn, objGrid.y - 261 + y_spawn, "Instances", objTile);
with
Code:
instance_create_layer(objGrid.x - 261 + x_spawn, objGrid.y - 261 + y_spawn, "Instances", objObject2);
And see what happens. Does you game actually run, or does it get stuck again.
 
K

KulDud

Guest
My initial thought is that the problem is with your objTile, because each objTile instance on Game Start is creating a load of other objTiles instances which might also detect that it is still in Game Start and then each one of those instances creates multiple objTiles instances, etc, etc.
That would be an eternal loop which the game would never get out of and it probably would just crash after a while as all of your memory is consumed.
You should not have the objTile creating more objTiles instances. Try replacing this:
Code:
instance_create_layer(objGrid.x - 261 + x_spawn, objGrid.y - 261 + y_spawn, "Instances", objTile);
with
Code:
instance_create_layer(objGrid.x - 261 + x_spawn, objGrid.y - 261 + y_spawn, "Instances", objObject2);
And see what happens. Does you game actually run, or does it get stuck again.
It worked!! Thank you very much!
 
Top