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.

DarkBASIC Professional Discussion / sprite showing up twice - beginners question

Author
Message
JRNTexas
15
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 6th Dec 2011 05:26 Edited at: 6th Dec 2011 05:28
I took this code out of the DB PRo help for sprites:



It produces this:



Only one sprite is created but two show up. One is moved by reference (sprite 1) but the static one is the one that is recognized by getting the coordinates of the sprite (sprite 1).

How do you fix this so that there is only one sprite and all references are for the same sprite?
Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 6th Dec 2011 05:59
Hi there. So what's happening is that the sprite is being drawn in two ways. Paste sprite is a way of drawing the sprite manually but DBPs sprite system also draws the sprite. So if you want to use DBPs sprite system, you can get rid of the paste sprite command and replace it with:



or if you want to handle the drawing manually for some reason, you can hide the sprite like this:



So the complete code could be either this for the sprite system:



or this for manually placing sprites:



Also if you create your sprite using the CREATE ANIMATED SPRITE command, then it is not initially visible anyway so you can use paste sprite without the sprite being automatically drawn as well.

Hope that helps.

JRNTexas
15
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 6th Dec 2011 22:58
@Lucas Tiridath

That is just what I needed Lucas. You've been a great help!

Login to post a reply

Server time is: 2026-07-10 19:48:12
Your offset time is: 2026-07-10 19:48:12