Note: this extension is currently in beta testing, it’s still not finished, so it likely contains lots of bugs.
You should be able to see it if you just type soleb244/advanced-particles
It works for me, but there’s something with local extensions or whatever, so I need to test if others can use it too. If you tested it and it worked, react with , if it didnt react with a please.
As I said, it’s not finished; there are some JS-only features and features that I haven’t coded yet, so here are some planned features:
Planned features
adding all the other particle and spawner properties to blocks
skipframes or minimal-deltaTime for particles to optionally improve performance (you’ll understand when it’s finished)
rectangles that do something to all particles within them (accelerate them, destroy them, etc)
global functions that affect all particles, for things like explosions
custom particles that work with all the other systems but allow you to create your own rendering function
just looking at your extension i can see some things that could be changed. What i could fins was that instead of this:
class Particle {
x: number // _x keeps it hidden in js when user is coding
y: number
}
enum ParticleProperty {
X,
Y,
...
}
function getProperty(particle: Particle, property: ParticleProperty) {
switch (property) {
case ParticleProperty.X:
return particle.x
case ParticleProperty.Y:
return particle.y
...
}
} // also create a setter
you can actually do:
class Particle {
_x: number // _x so that the get/setters work
_y: number
get x() {
return this._x
}
set x(to: number) {
this._x = to
}
get y() {
return this._y
}
set y(to: number) {
this._y = to
}
}
It keeps the code cleaner and faster, and you you can do myParticle.x rather than getParticleProperty(myParticle, ParticleProperty.X)! And if you dont know the best way to create the ///%'s, i recommend looking at the Sprite class, specifially right here. Note that these get/setters only work inside classes, and not namespaces or interfaces!
Can you give me some examples of how this could be used? It seems that this could be really helpful with some particle effects I’m making. Also, I was wondering how you made have a beta flag when you import the extension because that would be really helpful in some of my extensions!
The gradient changes the color throughout the lifetime, and you are setting the lifetime to 2000 seconds (i know its not obvious that they are seconds and not miliseconds, I will fix that) so it would take like 400 seconds before the color changes.