The Daily Click ::. Forums ::. Klik Coding Help ::. Same object collisions
 

Post Reply  Post Oekaki 
 

Posted By Message

easyname



Registered
  15/04/2008
Points
  450
31st December, 2008 at 19:28:55 -

Basically, I have a platform physics system set up using a fastloop based engine, and I'm using qualifiers to make objects that move and interact with obstacles, however, I am having problems getting 2 objects to collide. Is there a simple way of telling the objects apart so that I can handle the collisions properly. I just can't get it to work D:

If anyone wants the .mfa, I'll send it, though I can't right now as I'm on another computer (as my laptop currently has no internet connection)

 
n/a

easyname



Registered
  15/04/2008
Points
  450
31st December, 2008 at 23:48:14 -

Actually, I just figured it out myself

Yay.

 
n/a

easyname



Registered
  15/04/2008
Points
  450
3rd January, 2009 at 09:34:49 -

It seems that my previous way of fixing it messed up some things later. I've started on this bit again, and I want to get two of the same object collide properly without using detectors.

Currently I'm trying: (the currently moving obstacle has flag 0 on)

On loop 'MoveX'
Object collides with Object

Set Object flag 1 on

On loop 'MoveX'
Object flag 0 is on
Object flag 1 is on
Object MoveX > 0

Set Object MoveX to 0
Set X position to X - 1

On loop 'MoveX'
Object flag 0 is on
Object flag 1 is on
Object MoveX < 0

Set Object MoveX to 0
Set X position to X + 1

On loop 'MoveX'
Object flag 0 is off
Object flag 1 is on

Set Object MoveX to (a value I stored earlier, the moveX that the moving object had before being hit)

But it doesn't work at all. Where am I going wrong?

Edited by easyname

 
n/a

Remius Norumenu



Registered
  03/10/2008
Points
  6
4th January, 2009 at 08:16:26 -

This issue here, IMHO, is MMF's most fatal flaw -- Object management.

Basically, it isnt working because somewhere down the line, MMF2 is failing to distinguish which items are doing which. ive spent hours trying to find ways to get MMF2 to do things like this, and have just given up completely.

In the end, either it'll take a reletively complex system, or you'll just have to know exactly what your doing and seperately program more than one instance of the same object.

Its easier to do this kind of thing when the objects are created at the start of the frame, but creating them in-game and trying to assign them ID's? Its complete Hell.

 
Well well well.



That is all.

traugott.simon



Registered
  23/08/2008
Points
  91
5th January, 2009 at 12:29:10 -

Well in my top down game i stood before the same problem.
Collison detection was just crap and just making them bounce doenst look good.
The main problem is that you cant specify which object you call when two of the same kind collide or two of the same qualifier.


So my idea was to tell the enemy to jump some pixels away, if it comes to close to antoher one.
I solved it by creating an detector for each enemy, following it.
Now i can say:
if enemy collides with the detector of (another) enemy and its X is < detectors X, the push him away with 1 pixel.

After some time i was able to add enemys at runtime and everything runs now without any bugs.
This was definetly the hardest part of coding for me but it is possible.
Now every enemy has his own room of 16 pixels around they all will push away from each other an this looks very good.


 
n/a

easyname



Registered
  15/04/2008
Points
  450
5th January, 2009 at 17:32:48 -


Originally Posted by easyname
It seems that my previous way of fixing it messed up some things later. I've started on this bit again, and I want to get two of the same object collide properly without using detectors.


I used detectors before that, but it messed up some other stuff I was adding in :/

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
6th January, 2009 at 03:19:52 -

It is possible to differentiate between duplicates using loops and fixed values. You can use this principle to detect collisions between two duplicates and then make them do different things.

I made this example in 2007 to demonstrate the idea:
http://theclickteam.com/epicenter/ubbthreads.php?ubb=showflat&Main=10038&Number=69518#Post69518



 
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
   

Post Reply



 



Advertisement

Worth A Click