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 Professional Discussion / 3d effect / 2d sprite

Author
Message
henrikh2008
16
Years of Service
User Offline
Joined: 25th Apr 2010
Location: Denmark
Posted: 20th May 2010 00:40
i was just thinking, it could be really cool to add some 3d special fx on 2d sprites, like if you have pacman walking in his maze, a light fx could be added to pacman sprite, or he could be surrounded by fire particles, snow, flashing light, or explosion...

so i will properly need to add eks, a light "make light, position light). ?,
or can i use small avi file for the sprite (fx explosion).

is this not possible at all ?.

i dont want to buy any ekstra plugins for 2d fx, at least not for the time being.



male, live in denmark.
38 years old.
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 21st May 2010 00:57
You can add effects that resemble 3d but you can`t apply reall 3d effect on 2d sprite.Forget about lights, grab the brush!

Where there is a will, there is a way.
I often edit my posts, that`s who i am
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st May 2010 11:18
You could do this by texturing planes with the same image you would have used to make your sprites but whether it would light the image realistically would depend on the image and the style of the game.

Do you have an example of your current code (or an exe) that we could look at?

henrikh2008
16
Years of Service
User Offline
Joined: 25th Apr 2010
Location: Denmark
Posted: 21st May 2010 14:30
i mean i want to use 3d light commands like (make light, position light x,y,x, camera x,y,z), and add it as a "2D" fx onto a 2D sprite, so the 2d sprite can have a light, man, its diffcult to explain, but somehow add a light over a 2d sprite, thats its surrounding. (if the sprite moves, any obstacles allso get brighter, even the background picture, gets brighter, but only where the sprite move/is (light, only occur in a radius as big as the sprite itself!, if you know what i mean!)
i did try snow particle, i just have to let dark basic pro draw it in front of a 2d sprite.

yes well, i could post my pong game (its really fun, nice graphics in color), but there is some errors i have to fix, but anyone feel to improme my game is welcome.

how do i make a code-snippet for the soruce-code ?, so
i can put it in this forum.




baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st May 2010 15:36
Quote: "if the sprite moves, any obstacles allso get brighter, even the background picture, gets brighter, but only where the sprite move/is (light, only occur in a radius as big as the sprite itself"

I think I get what you mean and in that case I think you could acheive something like what you want using my method. Have a try!

Quote: "how do i make a code-snippet for the soruce-code ?"

1- click the "code" button above where you type in the "Post Forum Message" area (at the bottom of this page)
2- copy and paste in your code from the editor in just after the word "code" (in square brackets)
3- click the "code" button again (it will put "/code" in square brackets after your code).

I'll take a look and see if I get what you want to do...

TyJBr2
AGK Backer
16
Years of Service
User Offline
Joined: 30th Jul 2009
Location:
Posted: 22nd May 2010 10:35
Mabey try using another sprite with transparency that is the shape and color of the light.
henrikh2008
16
Years of Service
User Offline
Joined: 25th Apr 2010
Location: Denmark
Posted: 22nd May 2010 20:50
i think i figured it out (light fx on a 2d sprite!)

1. first i did use a bitmap editor like photoshop (trial version),
then i nned to draw a sphere with with in the midt and transparent at the edge of sphere radius.
2. save that image in png format (it should save transperancy infomation.
now put the image into the sourcecode of dark basic pro, and there you have it, a sprite with a ekstra light over it, if the sprite comes close to any obstacles it will too get brighter, its all about using the command "set alpha image no, alpha value.
setting aplha value to zero, will cause the sprite to be
complety invisible and opersite will show sprite with no transperancy.







here is a eks of particles beside the sprite but the particles is not positoned at the exact position as pacman sprite (i dont know how to do it!).




i am allso working on a idea of putting a pat with a machine gun, shooting down the opponent, but player 1 or 2 can only get the machinegun if they hit a certain brick with the machinegun symbol, infact i allready coded it into my pong game which is a mix of arkoniod and pong, but its only a test game for now.

i do have trouble with the firing bullet from the machinegun,the position of the bullet has to match the bat`s position, it dosent !.


her is my code (i will figured it out soon).






henrikh2008
16
Years of Service
User Offline
Joined: 25th Apr 2010
Location: Denmark
Posted: 23rd May 2010 00:00
here is the 2d light sphere picture , where most white becomes non tranparent and less white becomes more transparent.

picture attachment. zipfile.


Login to post a reply

Server time is: 2026-07-25 16:19:37
Your offset time is: 2026-07-25 16:19:37