Code for only specific objects

the should be a way to have code for only a specific object, so i can have 2 of the same object, and only one of them disappears. It would be a great way to save up sprite space for free users.

3 Likes

Depending on the stuation you can do this using Object Names—name one object one thing and another object a different thing, then have that type of object extract its object name and run different code based on which name it has.
Or, of the objects are spawned, emitted, or attached, you can send a number to the Spawn, Emit, or On input and then extract it (“extract this Starting Value”) and use that number to differentiate which object does what.

2 Likes

This is actually the reason the “id” is an extractor option.
If you kill a clone in one level and want it to stay dead when returning to the level,
you could put the ID of the objects that are dead in a list and kill the already dead objects in that level.

About the same thing as to the names idea that @thebrickccentric said.

3 Likes

There are a few ways to do this, you can make the objects Level dependent, Position dependent, or Name dependent. You can also use raycasts, but I wouldn’t recommend it.

One of my earlier examples so I’m sure it’s flawed. Being able to turn off entire bundles would make things easier and would help to code overall I think, so that would be an interesting feature to add.
What JR said would work well for what you’re trying to do. (Quick Note, if you spawned the objects in this would not work because they would have different ID (I think, I haven’t actually needed to use ID often))

If you were able to make object-specific coding easily (JR made a game with 1 object, but I doubt most people want to go through that) then that would basically be indie. You could just use animations to determine what the object looks like.

3 Likes