1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 Drawing Tons in the Background?

Discussion in 'Programming' started by William Garrison, Nov 8, 2019 at 5:04 PM.

  1. William Garrison

    William Garrison Member

    Joined:
    Apr 16, 2019
    Posts:
    50
    Okay so something peculiar is occurring. I have eliminated script by script but its still happening. So it looks as if the sprite animation is drawing over and over and over and over in the background behind the background in addition to the main object itselfs sprite? Thats all i can guess.

    Here is what is visually happening. The sprite thats "playing" on top is seemingly also stacking tons of themselves in the background.
    [​IMG]

    Here is all of my code. Every bit of it...
    [​IMG]
     
  2. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,198
    Normally I would say you arent drawing a background and that causes the stacking usually. (Reason explained 7 billion times on this forum). But this does look weird. It only seems to stack in these grid lines. And in addition, only the semi-transparent aura seems to stack. Is this grid you see in the game done by you? How are you drawing these?
     
  3. William Garrison

    William Garrison Member

    Joined:
    Apr 16, 2019
    Posts:
    50
    the grid itself is just a single png image i have on the background layer of the room. So i can (eventually) line the cubes up. Here is a GIF of me triggering the next sprite to come in and vanish. So then you can see the background oddities.

    [​IMG]

    Wanna hear something more strange? I removed the sprite grid thing. And now its gone. Doesnt do it anymore. But the second I put ANY sprite in the background layer it does it.
     
  4. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    2,182
    I think what's happening is you aren't clearing the display buffer, so what was drawn previous frame, is stacking up in those black spaces.
     
  5. William Garrison

    William Garrison Member

    Joined:
    Apr 16, 2019
    Posts:
    50
    I have "Clear Display Buffer" ticked. So i dont think thats it. But i was hopeful.
     
  6. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,198
    I suggest adding a background in the room editor. This background can just be black as long as it fills the view and isn't transparent.
    Or alternativley enable clear display buffer in the room editor.
    upload_2019-11-8_19-25-7.png
     
  7. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,198
    Ok, if it's not that, then it must be some draw-rule code or shader.
    Do you have code in your draw event? Can you show us this?
    Or are you using shaders?
     
  8. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    2,182
    Apparently clearing the display buffer is not enough. You'll want to also make sure that you're drawing a non-transparent background of some kind (can just be a solid color).
     
  9. William Garrison

    William Garrison Member

    Joined:
    Apr 16, 2019
    Posts:
    50
    Bingo! I think the Alien has it. Both images I was trying out had some level of transparency to them. Even WITH a color background selected. Once you remove the image that has transparency to it you are good to go. Long story short you cant have a rear facing image as the background with transparency in the slightest.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice