So far I've been able to create my own element and use it within the game, so now I want to try and attempt to learn how to make them react with other elements. I'm not too into coding, but I know a little bit. I just want to know a couple of things so I can understand what I'm looking at when looking at the code.
function test(i, x, y, s, n)
So I think x and y refer to the particle's position. I just want to know what i, s, and n are.
Is there also an update function?
Well I'm gonna explain (what I know atleast).
I stands for the particle itself, it's ID or index, whatever you want to call it.
S is the number of empty spaces around it.
N is the neighboring particles, not their actual properties but just how many there are.
And yes there's an update function.
Thanks. Was finally able to make my first element with a reaction. :-)
Edit: So after tooling around a bit, I've noticed that the elements that are involved in the reaction cause the FPS to drop after a lot of it is placed on screen, e.x If I made a reaction involving water with one of my elements then a lot of water would slow the fps down if the script was running. Is there a way to make the game run better?
I don't actually know, I have the same problem with the FPS hitting the floor as soon as I place lots of an element down, most notably sensor elements (those similar to TSNS, PSNS, LSNS). Probably because, for example, VSNS, a velocity sensor I made, has to do a whole ton of math to find out the total velocity of a particle, then generate spark in all directions, which is probably very hard for tpt to do.
I managed to fix it. I think it might have been because I was using the Update function instead of the element fuction. Works perfectly fine now.