• 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 Visible Object not Appearing, Invisible.

R

RylanStylin

Guest
I have an object in my game called EndOfLevel. It is created whenever a level is completed. I recently changed the sprite of this object to a new one. After I did this, the object disappeared whenever i launch the game, but still existed, and was therefore invisible. Here is everything I have tried:

1. Using CNTR + SHIFT + F to search for all times EndOfLEvel is references. None of them should be causing this problem. I also checked the code inside of EndOfLevel

2. I set the game to end if the instance existed. The game ended at the appropriate time.

3. I set the layer to be the highest, a depth of 0, there are no other layers above this one. I understand that a higher number means lower down.

4. Changing the sprite back to the old sprite. Nothing. Reimporting the sprite did nothing. Changing the name did nothing.

5. The only tag i have selected inside of the object is 'visible' so thats not the problem.

6. I have had the game draw the location of this object, it is not moving off screen and is in the correct position.

7. I have manually set its image_alpha to be 1 in the create event and step event.

8. I have manually set the sprite_index to be EndOfLevelSprite in the create and step event.

I legitimately am at a dead end here, any advice is much appreciated.
 

Rob

Member
Did you check the sprite origin? Maybe a mis-click has set the origin point to some extraordinary number.
 
R

RylanStylin

Guest
Did you check the sprite origin? Maybe a mis-click has set the origin point to some extraordinary number.
The Origin is correct, set to the Top-Centre of the sprite, at 200,0
 

Rob

Member
The Origin is correct, set to the Top-Centre of the sprite, at 200,0
The only thing I can think of is if you have a draw event and you're not using draw_self or draw_sprite.

It could be one of those weird 2.3 bugs that I've encountered. I had one object where I updated the step with more code and it just didn't run. I did everything I could to debug and no luck... Finally I just made a new object, copied the code over and it worked. It wasn't a case of the object not being in the room, and the object had been working.

So... if you've exhausted all option so try that - make a new object, copy the code over and see if that works. Give a new name to the old/new object
 
Have you tried clearing the cache (the little broom icon next to the play button)? GMS has recently started making me clear the cache every time I make a change to a sprite, otherwise, it doesn't show the sprite, or it shows the old sprite or it shows a random part of the texture page. Been meaning to file a bug report about it.
 
R

RylanStylin

Guest
The only thing I can think of is if you have a draw event and you're not using draw_self or draw_sprite.

It could be one of those weird 2.3 bugs that I've encountered. I had one object where I updated the step with more code and it just didn't run. I did everything I could to debug and no luck... Finally I just made a new object, copied the code over and it worked. It wasn't a case of the object not being in the room, and the object had been working.

So... if you've exhausted all option so try that - make a new object, copy the code over and see if that works. Give a new name to the old/new object
Did what you said, made a new object, copied code, etc, nothing. I was just spawning the object in, this time i tried drawing it as well. Nothing. This tells me theres something wrong with the way sprites are being drawn???? IDK, it doesnt make any sense, everything else still works fine.

Have you tried clearing the cache (the little broom icon next to the play button)? GMS has recently started making me clear the cache every time I make a change to a sprite, otherwise, it doesn't show the sprite, or it shows the old sprite or it shows a random part of the texture page. Been meaning to file a bug report about it.
Tried this, didnt work....sounds like it should work, maybe it will help at some point idk. Thanks for the suggestion.

I'm gonna try messing with some other sprites and see what happens

EDIT: Tried messing around with the sprites. What I found is that when i set a different object to have the same sprite as the problem object, the sprite loads for that object. This tells me that hte problem is unique to this object. However, I have dleted and recreated this object like 4 times. (Not using duplication) so...the problem must reside in the code of the object. Posting it below.

(there was code here, but i removed it)

I tried commenting out the code, but it didnt work. Still broken. Doesnt make any sense.

Tried creating a different sprite entirely in Aseprite. Nothing. Tried using other sprites. Nothing. IDK why this object doesnt work for this, this sprite worked for other objects
it DOESNT MAKE ANY SENSE
 
Last edited by a moderator:
Top