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 Discussion / Benefits of using PASTE SPRITE

Author
Message
gaz5021
18
Years of Service
User Offline
Joined: 18th Oct 2006
Location:
Posted: 29th Oct 2006 10:04
What are the benefits of using the PASTE SPRITE command, rather than just using SPRITE?
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 29th Oct 2006 10:32
They're two different commands, so cannot really be compared. Paste Sprite requires a sprite to already exist before you can use it, and literally just creates an 'impression' of that sprite at the given coordinates on the screen. So say you wanted to do some kind of static multiple explosion - you could have one sprite for this, then paste it all over the place, then scale it, then paste it again, etc., rather than using up lots of sprites for the same end result. It's sort of like an instance object, although not quite as permanent.

"Bite my shiny metal ass" (Futurama)
"Don't ping my cheese with your bandwidth" (Dilbert)
gaz5021
18
Years of Service
User Offline
Joined: 18th Oct 2006
Location:
Posted: 29th Oct 2006 12:40
Thanks. Could you please give me some advice on how to control the order of the sprites on screen? I'm trying to control (and change) which sprites appear in front of (and behind) others in my game.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Oct 2006 22:47
Using paste sprite also solves one of the most frequently asked question... "How do I put text over a sprite?".

Another benefit is the ability to use sprite commands to manipulate the image and paste the changed image to the screen (scale, strech, mirror, flip, and in Pro rotate).

In Classic the sprite order is the order in which the sprites were created. The first sprite will be under the second... the third sprite will be on top of the first and second sprites.

If you upgrade to Pro you'll get "set sprite priority" which allows you to change the order of the sprites.
gaz5021
18
Years of Service
User Offline
Joined: 18th Oct 2006
Location:
Posted: 30th Oct 2006 13:18
Thanks again. For my 2D beat'em up, I guess I need to determine the order of my sprites every time I draw them, depending on the y co-ordinate of each character.
gaz5021
18
Years of Service
User Offline
Joined: 18th Oct 2006
Location:
Posted: 30th Oct 2006 13:20
...mirror...

I currently have an image loaded for every frame of animation, one ending in "L" and one ending in "R"...

So, I could halve the number of images I'm loading, and use a "mirror" modifier depending on which way the character is facing before pasting the sprite?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th Oct 2006 20:32
Yup.
gaz5021
18
Years of Service
User Offline
Joined: 18th Oct 2006
Location:
Posted: 31st Oct 2006 09:48
Sweet. Thanks heaps for all of your help so far. I'm lovin' this DarkBASIC.

Login to post a reply

Server time is: 2025-05-25 22:20:35
Your offset time is: 2025-05-25 22:20:35