Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [SOLVED] Drawsprite and Background?

Author
Message
Tweak4141
2
Years of Service
User Offline
Joined: 23rd Apr 2022
Location:
Posted: 25th Apr 2022 06:01
Currently, I'm creating a game that utilizes a life system.
To display these lives, I'm creating a sprite, moving it to the next position, and then drawing that sprite at that location.
This works fine without a background, but once I load a background in using a sprite, the drawn lives not show.
How would I fix this?

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 25th Apr 2022 10:05 Edited at: 25th Apr 2022 10:06
This post has been marked by the post author as the answer.
without a basic code example from you, i imagine you're using DrawSprite() so, whichever you draw first will be behind subsequently drawn sprites.

if you used CreateSprite(), then SetSpriteDepth() to ensure the order you want.

hope that helps.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Jun 2022 07:00
Maybe ur sprites are being drawn behind your back ground you can fix this with setspritedepth. Alternatively make sure ur sprites and or images are not using the same number, and if u are manually drawing with drawsprite(). The oder in witch u draw matters background back to front.

Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 6th Jun 2022 18:29 Edited at: 6th Jun 2022 18:30
Use SetSpriteDepth send the background to the back where it belongs, give it the highest number of all of your sprites. Anything you draw for score and life data I would set the depth as 1 and any borders or peep holes as zero.

Login to post a reply

Server time is: 2024-11-21 12:38:09
Your offset time is: 2024-11-21 12:38:09