The Daily Click ::. Forums ::. Klik Coding Help ::. Problems in MMF with collusion detection
 

Post Reply  Post Oekaki 
 

Posted By Message

Yai7

Peace & Love

Registered
  28/01/2002
Points
  3178

12th August, 2010 at 12:05:09 -

The problem is, that when I have to monsters and one is in the front, the other is on the back, and when I want to shoot the one on the front, it also eliminate the one that stands on the back as well.

This problem in MMF is terrible since you can't make games with 3/4 diagonal view like Simcity 2000, where if you want to demolish a building and click on it, it will also destroy any building that collides it in the background!

Click Team must do something because if you have 2 same active1 object touched together and you use an object moved by mouse for example when you click on one it destroy the active1 at the front as well as the active 1 in the background! It must be controlled if I want this or no!

Something must be done!

Tell me if you ever had the same problem, and if yes, what did you do when it occoured?

 
(=

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
12th August, 2010 at 13:44:38 -

eg. Using the Select Object extension:

+ Always
-> Active1: Set Alterable Value A to Y("Active1") // or layer#, or whatever

+ User clicks left mouse button
+ Mouse pointer is over Active1
+ Select Object: Select single Active1 with the highest Alterable Value A
-> Active1: Destroy

Note that you can't use "User clicks on Active1"; similarly if you were checking for collisions you'd have to check that objects are "overlapping" and not "colliding".


Another useful trick (not strictly related to your problem), is to say something like:

+ Always
-> Active1: Set Alterable Value A to -1

+ User clicks on Active1
-> Active1: Spread value 0 in Alterable Value A

This way, any instances that haven't been clicked have a value of -1, while any that have been clicked get a unique value ranging from 0 upwards - making it easier to handle them separately (eg. by using the value as an ID when fastlooping through instances).

Edited by Sketchy

 
n/a

Yai7

Peace & Love

Registered
  28/01/2002
Points
  3178

13th August, 2010 at 10:49:04 -

This is outstanding... Just outstanding... I should check this.

 
(=
   

Post Reply



 



Advertisement

Worth A Click