particles
Blitz3D Forums/Blitz3D Beginners Area/particles
| ||
Hi, I need some help with some particles I'm making. I want the particles to be able to spawn off new particles but I'm having problems with this.For p.particle = Each particle p\x = p\x + Sin(p\d) p\y = p\y + Cos(p\d) p\c = p\c - 15 p\l = p\l - 1 If p\l = 0 Then Delete p Next How can I create a new particle that clones an old one while going through this loop? |
| ||
hey, the trouble with doing that is that when you create a new particle, it will get inserted at the end of the line, and the For loop will be at the end. this will cause the particles in between to not get updated. i had this problem myself, so i had to create the new particles after the loop was finished. i did that by creating a new type collection. sorry i cannot give you any code right now. i will post later if no-one else has. :) |
| ||
Well, I want the new particle to inherent the stats from the old one before I alter it. Could I do it with two particle types and then alternate between them.For p.particle = Each particle ; clone old particle p2.particle2 = new particle p2\x = p\x p2\y = p\y p2\c = p\c p2\l = p\l ; alter old particle p\x = p\x + Sin(p\d) p\y = p\y + Cos(p\d) p\c = p\c - 15 p\l = p\l - 1 If p\l = 0 Then Delete p Next and then have one type particle and another particle2 and then have update rutines for both where they use the opposite to create new particles? I hope that makes sense. |
| ||
yeah, i think you could do that too. might be a bit more complicated, but you could do that. the more i think about it, it's a good idea :) |
| ||
How would you do that effect where you have one particle moving and leaving a trail after it? I've been trying to do that but it doesn't really work. |
| ||
Particles leave a trail after them by lowering their alpha and reducing their scale throughout their lifespan. IE: You have a trail of sprites with the size and alpha decreasing. Not one particle as such. |
| ||
Well, I'm thinking 2D here, not 3D. I'm using BlitzPlus and there is no alpha. There got to be a way to mimic that in 2D though. I'm thinking that I could have the particles clone themself but in a less bright version or something like that. |
| ||
Well you could either write your own alpha function ( which would be pretty fast with BlitzPlus' fast pixel operations ) or use one of the alpha functions people have already written. Or you could pre-draw the particles duller as you suggest. Give the alpha a shot though. It might look good. |