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 DBPro Corner / Multiple sprites from 1 loaded image

Author
Message
jerryd
11
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 3rd Mar 2013 05:12
DarkBasic forum,

I know when you load an image you give it an identifing number
such as 1. Now when you use that image as a sprite you refer
to that number. How can I make several identical sprites from
1 loaded image all with different numbers?

jerry
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 3rd Mar 2013 07:15
You simple call the SPRITE command multiple times with different sprite numbers:


You can also use a FOR loop if you want to create lots of sprites:


Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 5th Mar 2013 01:16
If they're all gonna be identical, use clone sprite.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 5th Mar 2013 13:23
Or just paste that sprite.

"Get in the Van!" - Van B
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Mar 2013 18:40
^But you'd have to do that every loop, because pasting sprites only keeps them on the screen until you refresh again.

TheComet

Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Mar 2013 00:55
If the sprites are moving around then you'd need to clear them anyway.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Mar 2013 22:14
That happens automatically too if you set "backsave" to one (default anyway).

Quote: "SET SPRITE
This command will set whether the specified sprite restores its background and whether background transparency is ignored.

Syntax

SET SPRITE Sprite Number, Backsave, Transparency

Parameters

Sprite Number

Integer
The sprite number


Backsave

Integer
Backsave flag, if set to zero, the sprite will not restore its background


Transparency

Integer
Transparency flag, if set to zero, the sprite will not treat black as a transparent color
"


TheComet

Login to post a reply

Server time is: 2024-03-28 10:23:42
Your offset time is: 2024-03-28 10:23:42