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 / Two part question about sprite maps and transparency

Author
Message
fhtughryf
16
Years of Service
User Offline
Joined: 1st Jul 2008
Location:
Posted: 23rd Jul 2008 00:14
Okay I know how to load an image and how to make that image into a sprite so on and so forth but what I'm having troubles understanding is sprite sheets!

How do I know the coords of the images so I can cut them out?

Also I noticed if I create a bmp and load it as an image then create a sprite image of the bmp it automatically makes the black background transparent and why is that?

Sorry two part question. Thank you for the time!
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 24th Jul 2008 17:21 Edited at: 24th Jul 2008 17:22
Answering Q2 first:
All images are rectangular, but if you want to do a 2D game then you may not want to be restricted to just square-shaped players and objects. So, the black background can be made "invisible" - all pixels coloured black are not drawn to the screen, and whatever is underneath is allowed to show through. As a result, you can have 2d graphics whatever shape you like. You're not restricted to using black as the transparency colour - use the "Set Colorkey" command to specify any RGB color you wish to be defined as invisible.

Q1:
If memory serves me right, the command your refering to is "Create Animated Sprite" (or is it "Create Sprite Animation"? Being mainly a DBC user, I'm not too sure). To use it, what you should do is make each sprite frame exactly the same size. Then, copy and paste one image at a time into something like MS Paint and work your way across the screen one row at a time. Save this new larger image, and when you load it as a sprite sheet, you get to specify how many columns and how many rows were on the image. So, if you have an 8x8 grid of frames, just specify 8, 8 as the parameters and DBPro will do the rest!

Hope this helps
RTR

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 24th Jul 2008 19:35
Also, check out the set sprite sprite num, backsave, transparency command to enable or enable the sprite transparency option.
fhtughryf
16
Years of Service
User Offline
Joined: 1st Jul 2008
Location:
Posted: 24th Jul 2008 23:17
So I guess you are saying that darkbasic uses black as a default for transparency if that's the case then I will try the colorkey approach.


Well obviously if I'm ever going to master this language I'm going to have to invest in some darkbasic pro literature.

I looked around at amazon and found maybe one book that looked promising but awhile back I founf an online source (PDF)X2 that seemed to be the answers to all my questions and it had great examples that yiou could use. Unfortunately these pdfs were just the demo so all that meaty stuff wasn't included.

I will try to find the source of these PDFs but I can't remember the website. Anyways guys thanks for your help!


I hope within a few months I will be able to post in the WIP, becuase at that point I will no longer be a noob, but instead move up a notch within this community.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Jul 2008 22:25 Edited at: 31st Jul 2008 22:26
Quote: "Also, check out the set sprite sprite num, backsave, transparency command to enable or enable the sprite transparency option. "

Enable or disable? lol

@fhtughryf: Go here and scroll down to TDK's tutorials. I'm sure you'll find all you need to get started there. Then you can check out the other tutorials mentioned in the thread. If you read those you should be able to make a game of sorts in no time. I'm sure you'll have a WIP within a few months if you keep at it. And as always, feel free to ask questions.

Login to post a reply

Server time is: 2024-11-25 19:56:19
Your offset time is: 2024-11-25 19:56:19