Object Focus: multiple overlapping collisions
Hey, I have a problem involving TGF2's handling of Object Focus.
I've already read up on MMF2's Object Focus and how it works.
I've got an event that occurs when my [color:#FF6666]Player[/color] object is overlapping a certain [color:#3366FF]Active[/color] object, and I want the event to occur once for every [color:#3366FF]Active[/color] object that the [color:#FF6666]Player[/color] is currently overlapping. Right now the event only runs once no matter how many instances of the [color:#3366FF]Active[/color] object the [color:#FF6666]Player[/color] is actually overlapping - and ONLY for the first overlapped [color:#3366FF]Active[/color].
So I want to test and run the event for each specific [color:#3366FF]Active[/color] that the [color:#FF6666]player[/color] is overlapping. It needs to be specific to the [color:#3366FF]Active[/color], too - I need to use the specific values attached to each [color:#3366FF]Active[/color] separately for other events.
I don't want to use an indexed fastloop because it might get expensive on the PC later on.
Is there another way to do it? Maybe??
If using a fastloop is the best way (or only way), then I'll probably still use it. But, I'm hoping there's a better way.
Oh, and I can load an example.mfa if it'll help me get some answers.
Re: Object Focus: multiple overlapping collisions
What a colourful post.
I was having problems with this earlier, too - I think that using an indexed fastloop is probably the best way, to see if the fixed value (or, more likely, a value that you've previously spread) of the Active is equal to that of the loop index before running the actions. This shouldn't chew up too much of the computer unless you're using heaps of actives - how many are you anticipating having to have in the frame at any time?
Failing that, you could always swap (Player overlaps Active) with (Active overlaps Player). That sometimes helps, but if you've read about object focus you've most likely tried that already.
Re: Object Focus: multiple overlapping collisions
Hmm. Yeah.
Oh! Yeah... Duh! You're right, I can just check the ones that are on-screen. I won't have an enormous amount of the [color:#3366FF]Active [/color]objects on the screen at any one time. They'll probably float around 20-80 depending on the [color:#FF6666]player[/color]'s position. I was hesitant to use a loop because the number of [color:#3366FF]Actives[/color] in the whole frame will probably be ten times that number for an average size "level" - or more.
So what if I use "Inactive if too far from window"? I mean, when this is checked on, exactly how far from the window is too far? The TGF2 docs aren't really clear about it.
To weed the off-screen [color:#3366FF]Actives[/color] out of the bunch, would it be best to use this option or add to the loop some kind of process of identifying the ones that are on screen and off?
Thanks for the reply, too.
Re: Object Focus: multiple overlapping collisions
But the Is overlapping condition should select all the objects overlapping your player object! If it does not, this is a bug. Can you send me an example file showing how it does not work?
Re: Object Focus: multiple overlapping collisions
Weird. I made an example to upload, and decided to throw the fastloop solution in to it too, but I can't get the fastloop to detect more than one collision either! Now I know I must be doing something wrong.
Here's the link:
http://www.sharebigfile.com/file/111520/OFCollisions-mfa.html
I just googled for the host. Dunno if there's more popular ones. To download, enter the code at the bottom and then it will make you wait 30 seconds (for some reason) and then you can download it.
I'm still mainly interested in the regular collision detection question, but if someone can tell me why the loop isn't solving it either, that would be helpful.
Thanks.