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.

Code Snippets / A 2d particle system

Author
Message
Cave Man
18
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 22nd Sep 2006 02:27 Edited at: 25th Sep 2006 15:32
i made a 2d particle system.

Here are the functions


Here is a parameter description for the Make2dParticles function.



and for Make2dParticlesA



The two parameters for Draw2dParticles are the xscroll and yscroll. incase you're making a sidescroller.

The parameters for xshift2dparticles are the amount that you want to move the particles, and the sprite number of the particles that you're moving

e.g.
SMOKE = 1
load image "smoke.png", SMOKE
sprite SMOKE, 0,0,SMOKE
XShift2dParticles(1,SMOKE)
This command is good for applying a wind.


A sprite number of 0 would cause it to affect all particles.
Vice verca with YShift2dParticles, Delete2dparticles, and BoundrysTo2dParticles.


BoundrysTo2dParticles will delete all particles with the sprite number you specify if it is out of the boundrys you specify.

Delete2dparticles will delete all particles with the sprite number you specify.


I attached a zip with an example how to use this.
(in the example, use the arrow keys for wind, spacebar to delete all the smoke)

Tell me of any bugs and plase give me suggestions.


Cave Man

Attachments

Login to view attachments
DarkMasta
18
Years of Service
User Offline
Joined: 21st Apr 2006
Location: Typed on your screen.
Posted: 22nd Sep 2006 09:08
All right. I'll try to look at your improvement when I'm at home again. Thnx for the updates. The 2dpartics will fit splendidly in my game...

Wherever you plan to go,
it's the next step you never know.
DarkMasta
18
Years of Service
User Offline
Joined: 21st Apr 2006
Location: Typed on your screen.
Posted: 24th Sep 2006 09:49 Edited at: 24th Sep 2006 09:50
Ok, the sparks are quite handy, but how about instead of steering the particle direction with x- and y-components, make
speed and angle options, so you can direct where and how far the particles shoot to...
I've tried to add such an option meself, but it didn't really work...

I'm trying to make the angle function.
Btw, the wind effects are really cool

Wherever you plan to go,
it's the next step you never know.
Cave Man
18
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 24th Sep 2006 22:49
I added one in. It's called Make2dParticlesA. I'll add a description in a minute.

DarkMasta
18
Years of Service
User Offline
Joined: 21st Apr 2006
Location: Typed on your screen.
Posted: 26th Sep 2006 16:54
Oh, thnx, I didn't spot that. Don't worry, I've already got the descriptions and all...

Wherever you plan to go,
it's the next step you never know.

Login to post a reply

Server time is: 2024-11-23 03:20:34
Your offset time is: 2024-11-23 03:20:34