|
Posted By
|
Message
|
![]() »xerus
Registered 6/28/2002
Points 675

|
18th May, 2005 at 10:16:11 PM -
When two objects overlap and both collide with an object at the same time, it only registers once. For example, two bullets overlap each other exactly and collide with an enemy. If I wanted to subtract hp from the enemy by 1 every time a bullet hit, only 1 would be subtracted in this case. Is there any way to test for multiple collisions or somehow accomplish what I want to do?
n/a
|
 Hernan
Registered 3/4/2003
Points 707
|
19th May, 2005 at 3:27:03 AM -
That's odd, I never had that. Which tool do you use, and can you show how you coded it?
This space is for rent
|
 Deleted User
|
19th May, 2005 at 6:41:52 AM -
Try this:
Bullet is overlapping an enemy
+bullet flag 0 is off
-->turn flag 0 on
Bullet flag 0 is on
+bullet is overlapping an enemy
-->destroy bullet
-->subtract HP
|
 Nuutti
Registered 10/26/2003
Points 1364
|
19th May, 2005 at 8:12:01 AM -
Or:
Bullet is overlapping Enemy
-Spread value 0 in Bullets Alterable Value A
-Start loop "Testcollide" times: Number of bullets
On loop "Testcollide"
-Add 1 to Global Value A
On loop "Testcollide"
+Alterable Value Of Bullet=Global Value A
-Destroy bullet
-subtract 1 from enemy health
i'm not sure if it works..
P.S. sorry for my mangled english.
|
 Deleted User
|
19th May, 2005 at 10:16:51 AM -
Yeah, can't be bothered to test mine either.
|
![]() »xerus
Registered 6/28/2002
Points 675

|
19th May, 2005 at 4:06:12 PM -
I got it to work with fast loops.
Before it was just when bullet collides with enemy (Im using groups)
I changed it to on loop "something", when bullet collides with enemy, pick one bullet, and then always run the loop 10 times. It doesnt seem to slow down at all from this.
Thanks for the input.
n/a
|
 Nuutti
Registered 10/26/2003
Points 1364
|
20th May, 2005 at 10:27:01 AM -
Yea 10 times fast loop doesn't slow down at all..
P.S. sorry for my mangled english.
|
 Duncan Thelonious Dunc
Registered 5/18/2002
Points 577
|
15th September, 2011 at 12:04:17 PM -
BUMP
I'm trying to do this. I'd really like to know the secret differences between "Collision between..." and "is overlapping". Multiple instantaneous overlaps will only register once, but the collision event counts for each object.
That said, the collision event does inexplicable things. For example, if you do this...
Bullet collides with Group.Enemies
+ Group.Enemies Flag 0 is off [or any condition which multiple objects have in common]
---> Destroy Group.Enemies
... Then you'll destroy a) the object involved in the collision, and b) any different objects in Group.Enemies that also meet the second condition (but aren't duplicates of the object collided with). Obviously using overlaps on the other hand works fine.
As a quick and dirty workaround I'm using...
Bullet collides with Group.Enemies
+ Bullet is overlapping Group Enemies
+ whatever else
... And this seems to work, but it makes me wince a bit.
Couldn't find much of relevance searching TDC, but if there are any threads or articles I should study please post them my way, cheers
n/a
|
 Duncan Thelonious Dunc
Registered 5/18/2002
Points 577
|
5th May, 2012 at 5/5/2012 6:12:56 PM -
^ Anyone?
The flag switcheroo doesn't work; the "collision between..." condition is a unpredictable (see above - I eventually dropped the method I was using, I can't remember why, but I'm going to assume there were more problems); I tried using a foreach loop but the swf exporter decided this meant "do something completely inexplicable!"; using a "pick one of" condition in conjunction with a loop or duplicated events works perfectly but it seems so weird that I can't fix this without a loop.
Also - what about projectiles that aren't destroyed on contact? And they might overlap two objects at once, or two of them might overlap the same object?
n/a
|
 Jenswa Possibly Insane
Registered 8/26/2002
Points 2217
|
6th May, 2012 at 5/6/2012 4:15:25 PM -
Interesting, I've never encountered this bug or defect by design of tgf/mmf.
So the bullets overlap each other, do they have an event for this? That should clarify things.
Hmm well, I just created a testcase with some setups for colliding and/or overlapping and I haven't encountered your problem. I've two red blocks (the same object) which overlap each other and they collide with a green block. The green block receives +1 for it's hp counter (value A) on collision and the red blocks are destroyed. Both blocks get destroyed and the counter displays: 2.
But what Duncan is telling is true: collision counts for each object, but overlapping counts for all objects just once. And that's weird because they (the red blocks) do get destroyed but they just add 1 once to the counter and not twice. So the action on each object that is overlapping gets executed, but the action on the object that is being overlapped just once.
Lovely problem, I would like to know more about it too. But now I've to for dinner.
Check out DTV Boxes http://ow.ly/k13fh (work in progress)
Download hh_beer.zip from http://ge.tt/4d07kPc/v/0 and hhxl.zip from http://ge.tt/3kbXlPc/v/0
|
 Duncan Thelonious Dunc
Registered 5/18/2002
Points 577
|
6th May, 2012 at 5/6/2012 8:32:05 PM -
Thanks for checking it out Jenswa, hope you had a good dinner!
n/a
|
 Assault Andy Administrator
I make other people create vaporware
Registered 7/29/2002
Points 5683
    
|
7th May, 2012 at 5/7/2012 9:32:48 AM -
I didn't read the whole post, but "On Collision" is handled differently to "overlapping". On Collision is uses default built in movements and doesn't work for custom movements, and a lot of other things because it triggers in different circumstaces (hence it is a red event). I personally use "Is overlapping" for all collisions.
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
|
 Jenswa Possibly Insane
Registered 8/26/2002
Points 2217
|
12th May, 2012 at 5/12/2012 1:41:00 PM -
Thought of a solution: write your own collision code for the bullets.
For example: check if the coordinates of the bullets are inside the (rectangular) area of your object.
Added after the edit:
Some little further experimenting delivered the following results:
1) Don't use "compare two general values" because once the conditions are met, the event is executed for each instance of the object! (In case of destroying: all objects are destroyed, and value adding just happens once, because the 'object' all instances is used (not sure if that all instances object really exists, but the results do).
2) Use the objects x and y position for collision testing through the object reference: X( "object" ). This way the conditions are tied to each of the instances of the object. (so not all objects are destroyed when one of the objects meets the criteria and value adding can happen multiple times).
One last note: tested this code with The Games Factory (not TGF or MMF TWO, but I think the results are transferable).
Edited by Jenswa
Check out DTV Boxes http://ow.ly/k13fh (work in progress)
Download hh_beer.zip from http://ge.tt/4d07kPc/v/0 and hhxl.zip from http://ge.tt/3kbXlPc/v/0
|
|
|
|