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.

2D All the way! / Convert image to sprite

Author
Message
Nepius
19
Years of Service
User Offline
Joined: 30th Aug 2006
Location:
Posted: 30th Aug 2006 23:02
How do you convert an image to a sprite?
I tried someone else's example of loading an image and then pasting it as a sprite but I'm getting an error.
Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 31st Aug 2006 01:02
its really not that hard, just use the sprite command

SPRITE SpriteNumber, xpos, ypos, ImageNumber


i dont see how your that xample wouldn't work, whats the code?

Nepius
19
Years of Service
User Offline
Joined: 30th Aug 2006
Location:
Posted: 31st Aug 2006 03:01
I figured how to do it now. I had to use the positionsprite command followed by drawsprite. What languages are these forums mainly focused on? I'm currently using PlayBasic. Does everyone think that DarkBasic is that much better? Maybe I will upgrade if the 2D features are that much better.
Digital Awakening
AGK Developer
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 31st Aug 2006 21:42
The advantage of using Dark Basic Pro over Play Basic when doing 2D is that DBP have hardware rendered sprites so you can use alpha chanel images. Over all I think PB have more 2D features but due to the lack of alpha chanels you can't create modern 2D graphics. If you want retro graphics then PB can do that.

Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 31st Aug 2006 22:55
Sorry! I thought you were using DBP, make sure you tell people what language you're using in your thread names
e.g. "Convert image to Sprite(PB)".

Nepius
19
Years of Service
User Offline
Joined: 30th Aug 2006
Location:
Posted: 31st Aug 2006 23:10
I'm currently using version 1.44 of Play Basic. It does have some alpha capability for it's sprites. Here is a list of some I found.
SpriteAlphaAddColour
SpriteAlphaColour
SpriteAlphaLevel
SpriteAlphaSubColour
and SpriteDrawMode which has an alpha blended mode.
Can the above functions perform as well as the functions in Dark Basic? I'm not too sure how exactly alpha channels work. I think it has something to do about how it blends the colors of two overlapping sprites or images.
Digital Awakening
AGK Developer
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 1st Sep 2006 04:58
DBP supports 32bit images, like PNG. While your screen is only 24bit (8 red, 8 green and 8 blue) 8 bits are used for alpha chanel. This means that every pixel in the image can have 256 levels of transparency (invisible to solid). In DBP this is also automatic and you don't have to do anything but switch the transparency flag to 1 for your sprite. This means that you can create anti aliased images that looks good on all backgrounds but you can also create things like fog, shadows, glass, ghosts, glows etc. Just use a program like Photoshop that supports transparency.

Login to post a reply

Server time is: 2026-07-07 01:30:31
Your offset time is: 2026-07-07 01:30:31