[extension] advanced particles

my first extension, yay!

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 :duck: , if it didnt react with a :snake: 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
  • updating the organisation of blocks in the editor

If you tested it, please give me feedback

8 Likes

This is such a gret extension man

2 Likes

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!

2 Likes

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!

3 Likes

Hey man no hate but ts is a scam wdym this is a fire gradient:


I don’t know if I did something wrong (since I spent like 30 seconds on this).

1 Like

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.

I thought you could just use myParticle.x in JS without anything added, the function was there mainly for block coding.