Particle effect equations
From VbGORE Visual Basic Online RPG Engine
Contents |
[edit] Introduction
Replace the code in Effect_EquationTemplate_Reset with the code provided below to replicate the effect
Any effect in this list MUST be made with Effect_EquationTemplate for ease-of-use. Any of the code posted should only be for the _Reset sub, unless specified elsewise. These equations are ment to show you how to create a certain pattern, and that is it! Suggestions will also be included on what you can do with that equation, but it is up to you to impliment that since creating an example of EVERY suggestion will create an overly huge list that'll be impossible to browse.
Please ignore the FPS - they are irrelevant to the equation. Most of these screenshots are taken in the IDE with 1000 particles on a crappy computer.
[edit] The Outlined Circle
One of the easier effects - the outline of a circle is great for casting spells on characters for a "power-up" effect. It can also be used for nova-style explosions, implosions, or just nifty effects.
Usage Suggestions:
- Implosion/Explosion by raising/lowering the radius of the circle while the effect is going
- Power-up effect by surrounding the target character and animating the particles upwards to fade out (this is how bless/protection/strengthen spell effects work)
- Changing the "360" value in A = to an increasing (clockwise) or decreasing (counterclockwise) value, which will create a worm-effect of the particles moving around the circle
Dim A As Single Dim X As Single Dim Y As Single 'Get the positions A = Rnd * 360 * DegreeToRadian 'The point on the circumference to be used X = Effect(EffectIndex).X - (Sin(A) * 40) 'The 40s state the radius of circle Y = Effect(EffectIndex).Y + (Cos(A) * 40) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt X, Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] The Full Circle
Very similar to the Outlined Circle, but this one fills in the full circle. It was worth mentioning since it can be a whole new effect in itself, even though the code is nearly the same. As you may notice, we have to store the Rnd value in variable B, or else we will get some areas more populated then others. Great for area-based effects!
Usage Suggestions:
- Create area-based effects, such as a poison cloud, by lowering the particle usage and changing the color
- Can use as the same methods that would be used in the Outlined Circle, but for a filled effect, such as the Nova or implosion/explosion.
Dim A As Single Dim X As Single Dim Y As Single Dim B As Single 'Get the positions A = Rnd * 360 * DegreeToRadian B = Rnd 'We must store the B value because it must be the same for Sin and Cos X = Effect(EffectIndex).X - (Sin(A) * (B * 40)) Y = Effect(EffectIndex).Y + (Cos(A) * (B * 40)) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt X, Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Atomic
An "atomic" style effect that you can minipulate into looking like hundreds of different things, just play around with the values under R.
Usage Suggestions:
- Play with the constants under R to create different styles
- Make a couple of non-dieing particles that follow the outline of the atomic shape
Dim X As Single Dim Y As Single Dim r As Single r = 10 + Sin(2 * (Index / 10)) * 50 X = r * Cos(Index / 30) Y = r * Sin(Index / 30) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.9 + (Rnd * 0.2)
[edit] Animated Sign
A strange effect which can create sort of "flower"-style patterns.
Usage Suggestions:
- Play with the modifier values for different looks - keep it a constant to make it unanimated
Dim X As Single Dim Y As Single Dim r As Single If Index = 0 Then Effect(EffectIndex).Modifier = Effect(EffectIndex).Modifier + 1 Effect(EffectIndex).Progression = Effect(EffectIndex).Progression + Effect(EffectIndex).Direction If Effect(EffectIndex).Progression > 100 Then Effect(EffectIndex).Direction = -0.02 If Effect(EffectIndex).Progression < -100 Then Effect(EffectIndex).Direction = 0.02 r = Effect(EffectIndex).Progression + 2 * Cos(2 * Index) * 40 X = r * Cos(Index / (Effect(EffectIndex).Modifier + 1) * 5) Y = r * Sin(Index / (Effect(EffectIndex).Modifier + 1) * 5) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Swirl
Creates a "Circle with attitude".
Usage Suggestions:
- Play around with the Progression value to find the kind of style you want
- Increase the multiplier (60) at the end of the X/Y to create the size you want
Dim X As Single Dim Y As Single Dim r As Single If Index = 0 Then Effect(EffectIndex).Progression = Effect(EffectIndex).Progression + 1 r = Atn(Index Mod 12) X = r * Cos((Index / Effect(EffectIndex).Progression)) * 60 Y = r * Sin((Index / Effect(EffectIndex).Progression)) * 60 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Heart
Remember making these babies on your TI-83 calculators? Well I do. Nothing shows that you want to get in someone's pants like a heart!
Usage Suggestions:
- This isn't just a heart - play with the values to create completely different effects!
- Use the 50 under the X/Y to scale the effect's size
Dim X As Single Dim Y As Single Dim T As Single T = (Index / 100) 'Theta angle Y = -50 * Cos(T * 2) * Sqr(Abs(Sin(T))) X = 50 * Sin(T * 2) * Sqr(Abs(Cos(T))) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Galaxy
Not the most usefull effect since you cant really do a whole lot with it, but people might find some use for it.
Usage Suggestions:
- Just play arond with the values, see what you come up with
Dim X As Single Dim Y As Single Dim r As Single r = Sin(20 / (Index + 1)) * 100 X = r * Cos((Index)) Y = r * Sin((Index)) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Fancy Thick Circle
A circle with a thick "reef-like" border.
Usage Suggestions:
- Refer to the suggestions for the circles above
Dim X As Single Dim Y As Single Dim r As Single r = 50 + Rnd * 15 * Cos(2 * Index) X = r * Cos(Index / 70) Y = r * Sin(Index / 70) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Flower
Very similar to the "Animated Sign". Default equation creates a flower-like pattern.
Usage Suggestions:
- Play around with the equation, see what kind of shapes you can come up with
Dim X As Single Dim Y As Single Dim r As Single r = Cos(2 * (Index / 10)) * 50 X = r * Cos(Index / 10) Y = r * Sin(Index / 10) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)
[edit] Wormhole
Creates an explosion that turns into a wormhole - you can create some interesting portals and such with this one!
Usage Suggestions:
- Play with the values in R to see what you come up with, along with the progression
Dim X As Single Dim Y As Single Dim r As Single Effect(EffectIndex).Progression = Effect(EffectIndex).Progression + 0.1 r = (Index / 20) * Exp(Index / Effect(EffectIndex).Progression Mod 3) X = r * Cos(Index) Y = r * Sin(Index) 'Reset the particle Effect(EffectIndex).Particles(Index).ResetIt Effect(EffectIndex).X + X, Effect(EffectIndex).Y + Y, 0, 0, 0, 0 Effect(EffectIndex).Particles(Index).ResetColor 1, 1, 1, 1, 0.2 + (Rnd * 0.2)




