Behavior Request: Colliding
-
While colliding is sufficient in most cases, but it doesn't return if it is being activated, and runs every Frame.
I need a "Colliding" behavior. Tags work like Collided does, however, instead of checking if they are colliding, and executing an event, it returns a bool attribute "Colliding", telling whether or not the object or objects are colliding.
This frees up some performance space, as it is invoked by the user, not by the mainloop, and allows for better mathematics in-game.
For instance:
If Object B is colliding with Object C and if not already triggered: add 1 to AmountColliding;
If object B is not colliding with object C and if not already triggered: subtract 1 to AmountCollding;
Finally subtract AmountColliding from HP; -
@Thecheater887 you could already do this! Without the behavior!
timer (every 0 seconds)
Get position (of selected object)
If (get position X > x)
If (get position X < y)
If (get position Y < z)
If (get position Y < n)
behaviors...The ifs set the object boundary.
They can be changed using "set input field" behaviors per moving object.
It's harder but it works! -
@GameCRAZY Thanks, but I need to be tag and loop heavy when using this in most cases, so having this for say 250 different object would bog down the project a LOT.
Additionally, I see "if"s like hammers.
A necessary tool, but deadly when misused. There it would be like giving 1000 three year olds hammers, letting the, loose, and expecting them all to behave and survive.
This for the suggestion though! I'll use it in smaller projects!
-
@Thecheater887 I'm using it for my level creator in my game. It's a pretty big scene and will be a huge system. Thing is, it isn't causing me any bugs.
It's hint you could still get what you want out of the sequence. If behaviors are one of the most important behaviors.
-
What device are you on? I'm on an older one, and any time I have 250 "if"s running, my game slows down to a crawl.
-
@Thecheater887 I'm on a first generation iPad Mini. I have tons of lag - but this isn't inluded in my list :)
-
@GameCRAZY I'm on iPad mini 2, and lots of lag as well, unfortunately, the ifs are on my list XD
-
If I understand your question, the simplest way to do this is to have an attribute with a default of 0 and when the objects collide set the attribute to 1 then when they stop colliding set it back to 0.
So, all you have to do is to get that attribute and if it is equal to 1 that means they are currently colliding!
Hope this makes sense, if you have any questions about this just ask! -
@iTap-Development ooh, I like that one... Works in most cases... Sounds so good... XD.
-
@GameCRAZY thanks! Just curios, you said works on most cases...what cases would it NOT work on? I'm not saying there aren't any!
-
@iTap-Development I'm not sure XD.