• 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.

SOLVED Sprites not Drawing

My project was working perfectly fine. I had a space ship shooting bullets at enemies. Had done several quick playtests to check things I was editing. Immediately after a playtest, I decided to edit my bullet and flash sprites (they are separate sprites assigned to separate objects). As usual, I opened the sprites and edited them one at a time. With one of the sprite editors still opened, I ran the game, and both the bullets and the flashes were failing to draw their sprites. The bullet object was working and destroying enemies, indicating it was utilizing the sprite's collision mask. I went back and closed the editor, but still nothing. After re-editing the sprites to make sure they were obvious and impossible to miss, still nothing was showing. Even though I had touched nothing else in between playtests, I double checked the object's visibility setting, made sure the layers were visible, and restarted Gamemaker. Eventually I went into the bullet object and created a Draw Event, telling it to draw itself along with a sort of crosshair sprite. This crosshair was unrelated to the objects, but I had not edited it. It looked like this:
Code:
draw_self()

draw_sprite(crosshair_sprite,0,x,y)
Lo and behold, it still failed to draw itself, but was drawing the crosshair sprite just fine. So I replaced the crosshair sprite with the sprite it was supposed to have. Just for fun, here's the code again:
Code:
draw_self()

draw_sprite(bullet_sprite,0,x,y)
Nothing was drawn. I created a new sprite, assigned it to the bullet, and inserted it into the draw_sprite() script, but that also failed to draw. It still drew the crosshair sprite, though. So I assigned the crosshair sprite to my bullet object, nullified my draw_sprite() line, and it didn't work. So then I reassigned the bullet sprite, told it to draw itself and crosshair sprite, and now it doesn't draw the crosshair sprite anymore. I then assigned my crosshair sprite to my spaceship, which then failed to draw itself. Then I reassigned my space ship it's original sprite, and that failed to draw. It's like an infection spreading across my sprites.

Is there anything I am missing? This seems to be the second bug I've had in the last few days.
 
Last edited:

Mandrell

Member
I just ran into this too. My project was working fine and then, suddenly, no sprites could be rendered. However, the objects were still being created. I was able to verify this by using show_debug_message() with the object id. I even did the same with the object's x and y coordinates. In the output window, I could see that the object had been created and was moving around, but nothing was rendered.

I also opened up several tutorial projects that I had done last week and those can't render sprites anymore either.

Any ideas?

Thanks
 

Mandrell

Member
ok.. I was able to fix this...

I created an asset layer in the room and dragged all the sprites onto that layer. I then ran the game and everything was created as I expected (my project is using instance_create_layer and draw_sprite). Then, I deleted the asset layer and re-ran the game. Again, everything was created as I expected.

I can only assume that GM lost the reference to the sprites? and adding them to the room forced GM to re-acquire them?

Super weird, but it is working again.
 

Mandrell

Member
The same thing happened with the Fonts. I had to rename the font and then change it back to the original name. Only then would the text be displayed..

After making this change, I diffed the source files and there were no file changes. Does GM cache files anywhere other than the project directory? It is odd that the project files did not change, but the font is now available to the project.

Is there a process for bug submissions?
 
Last edited:
I know it's been a while, but for the missing sprites, I found that it was an antivirus issue. My Avast antivirus was doing some weird thing and preventing GMS2 from accessing the files it needed to.
 
Top