It is also implied that you pass in the emitter class/table so that lua can use the self keyword, like: my_emitter.start_emit(my_emitter). create can be called on the emitter type like: emitter.create(64, 64, 1, 0). Call update() and draw() on the emitter each frame (using the game loop preferably)Ĭall these on your emitter.Call the update_time() function every frame.Add the emitter to either your global collection of entities, or your game object.
#How to get more emitters on particle illusion how to#
Check the spawn_emitter(emitter_string) function in ps-demo.p8 to see how to construct. Construct the emitter once and set the parameters you want use.The emitter is set up so you can have multiple running in the same game, either added to your world's entities collection or your game object. This is why you have to pass in a lot more details to the emitter than you do the particle. The particle is the thing you see, and the emitter is what makes it appear. The emitter is basically the 'spawner' of the particles. Emitters are created through the function in the table like This will include the contents of the code in your code, and you can create emitters wherever you like. To use the particle system in your game, please download ps.lua to your cart's folder and put #include ps.lua at the top of your game's code. I recommend looking over the code in ps.lua, but you may want to copy the code and view in a text editor of your choice, as it gets kinda horizontal. Generally speaking, the emitter creates particle objects and updates and draws them. The code can be helpful on how to implement the system into your game, but you can get started quickly by viewing how the ps-tiny-demo.p8 spawns a particle emitter. I'd recommend downloading the project and running the ps-demo.p8 demo to get a feel for the features that the system has. Rework backend to use entity-component system not happening soz.Emission shapes / emission in area done!.I'd like to get these features implemented next: It is not "lightweight", weighing in at just over 1500 tokens. This particle system is a fast and extensive implementation for the fantasy console PICO-8.