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 / 2d animations help

Author
Message
txchilixt
8
Years of Service
User Offline
Joined: 20th Feb 2012
Location:
Posted: 20th Feb 2012 21:36
Im making a 2d platformer and im using .gif images as the animations for things like explosions,walking,ect. Although I save the .gif images with a transparent background, when I loud them into DarkBASIC it puts a black square around the animation. Is there a way to have it transparent like the original image is?

Thanks,

Tyler
BN2 Productions
16
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 21st Feb 2012 07:03
I don't have much experience in using gifs, you you could try the SET SPRITE command. If you set the transparency flag then it will not draw any black pixels to the screen.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Feb 2012 07:26 Edited at: 21st Feb 2012 07:27
yeah try using something like Fuchia or Magenta

in the purple range here

http://en.wikipedia.org/wiki/Hex_code#Hex_triplet

the above page should be helpful for other things too



Hope this helps... hopefully DBC uses the same transparency colours as default... or look for a command to fit the bill and set the transparent colours manually..

EDIT

What I mean is... in your gif set the backgrounds all as Fuchsia or Magenta and then set the object transparency or something a those colours.

Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Feb 2012 05:03
Quote: "...or look for a command to fit the bill and set the transparent colours manually"

Unfortunately, DBC only accepts black as a transparent color.

Quote: "Although I save the .gif images with a transparent background, when I loud them into DarkBASIC it puts a black square around the animation"


Like BN2 suggested, if the transparent areas of your GIFs are true black,
RGB(0,0,0),

then use SET SPRITE to turn on transparency:



Just a note: if you set BackSave State to 0 you will get better performance. You will just have to control the clearing and redrawing of the screen yourself. The BackSave state flag allows the sprite to refresh itself regardless of what the background is doing. However, this adds some processing overhead.

Another tip on performance:
With the backsave state off (zero), you can keep all of your sprites hidden at all times. Whenever you need to display your sprites, you use PASTE SPRITE . This will make a "rubber stamp" of the sprite wherever you choose complete with transparency if set as described previously. This will also increase performance and it will also allow you to still use sprite collision detection.

Enjoy your day.
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 22nd Feb 2012 05:42
Latch... long time no see!!!

Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Feb 2012 17:17
@MrValentine

I still lurk about in the shadows from time to time.

Enjoy your day.
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Feb 2012 17:20
I see

Login to post a reply

Server time is: 2020-08-15 12:15:02
Your offset time is: 2020-08-15 12:15:02