So I have a whole bunch of platform objects. They all have an instance variable called "trigger" which I change to different values to achieve different things. Right now I do
-Player: On Colission with platform
-- Platform.trigger != 0
-> call function "te_" & platform.trigger
-> platform destroy
It's calling the function perfectly fine, but is deleting every platform instead of the one the player collided with. I know this has something to do with it not passing the platforms id to the function so it knows the specific one to delete. But how do I make it so it knows which one to do?
Sorry if it's confusing, I'm not the best at explaining things.
When you call the function, add a parameter, and set it to the platforms UID. Then in the function, use the "Pick by UID" condition, and set it to the function parameter.
-Player: On Collision with platform
-> call function "te_" & platform.trigger(Platform.UID)
-Pick Platform by UID (function.param(0)
I can't test it out right now but that makes perfect sense. Thanks!
Um, why do you need the function?
If you are changing that objects variable you can just compare it, and use that as a trigger.
No need for all the uid stuff. The object is automatically picked by its variable.
It's not just destroying that I'll be doing. I plan on having a bunch of functions that do different things depending on the trigger variable. I guess I could just have trigger = 1, trigger = 2, ... subevents. In my head this seemed like it would reduce the amount of events I would be using. (I have the free version so I have to watch my events)
Develop games in your browser. Powerful, performant & highly capable.
First of all why can't you destroy the object from the initial event?
It looks like its picked by the collision.
Second you would need a sub event to destroy it since you cant pick to destroy from actions.
I don't want to just destroy every platform when the player touches it. Each one can do different things depending on what trigger equals. So most of them will = 0 meaning it wont do anything on contact. 1 means it will delete when touched, 2 would make it disappea for 5 seconds for example. I get now that functions wont save on events and will just over complicate it. I'm just going to make sub events of on collision.