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.

AppGameKit Classic Chat / My 3d Torch Fire function here :)

Author
Message
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 22nd Mar 2019 06:53 Edited at: 25th Mar 2019 03:27
I thought id share my fire function with the community, it takes all the dirty work out of making fire for torches campfires and candles it comes complete with particles fire and smoke.



simply download the attached file and drop it into your project folder
then in your main project add these lines



this will create a smoke cloud, spark particles and moving flames, it has a built in offset to keep the sprites from running all over the place as the camera moves and the screen xy coods change. i

hope this helps someone enjoy

torch code separate below


EDIT: side not if you want more then one torch of fire add a seperate object for it to get xyz coord from but object number i believe needs to be 2 higher in number then the previous since it add images for smoke and particles. based off object id.
A child's dream never dies.





Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Mar 2019 08:55
nice smerf thanks for sharing
fubar
haliop_New
User Banned
Posted: 22nd Mar 2019 11:25
wow thanks !
Rick Nasher
6
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 23rd Mar 2019 19:46 Edited at: 23rd Mar 2019 19:49
Nice example, love the fire. Thanks for sharing, but 2 things:

- I think it should read move_fire(1,1) instead of movefire(1,1) in the main loop

- It doesn't seem to take other 3D-objects into account and always shows the fire sprites in the foreground of them.

I haven't delved into AGK's particle system enough yet to know how to tackle this, so that it appears behind 3D-objects when moving away from the box it's connected to.

Does this require a complete rework or is there an easy command or so to fix this?
I've seen for sprites there's a command to arrange the order of appearance SetSpriteDepth, but I'm not sure how that would combine within a 3D world, where for instance the main character of a third person shooter would move in front of the particle generated fire?
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 24th Mar 2019 00:21
you have to set the depth of your 3d objects or the depth of the particles or how ur game render's 2d and 3d front or back. that particles work as there supposed to better to be in front by default then behind i would imagine
try SetParticlesDepth( ID, depth )
A child's dream never dies.





JosephB
17
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 24th Mar 2019 00:54
Smerf,

Really nice, thank you. I added a Sync() command in place of the move command in your main.agc example. Following is the snippet for the main.agc file:

smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Mar 2019 03:26
yeah my bad it was pretty late an i was trying to piece it all together from different include files to make it work glad u guy are finding it useful, I was working on my game an realized i needed about 20 torches in a few different levels an immediately said the heck with setting all this up 100 times. Using it currently working great might make some better fire images later to make it really pop but for now its pretty good.
A child's dream never dies.





Login to post a reply

Server time is: 2024-03-28 08:21:11
Your offset time is: 2024-03-28 08:21:11