The Daily Click ::. Forums ::. Klik Coding Help ::. Does the order of conditions matter?
 

Post Reply  Post Oekaki 
 

Posted By Message

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
2nd September, 2009 at 01:45:24 -

It sounds like it has to do with MMF2's object selection system. It allows MMF2 to narrow down what object the actions will have an effect on, which makes it a lot easier and predictable to make games. Without it, it would be surprisingly difficult to make a game with multiple copies of an object.

 
http://www.facebook.com/truediamondgame

Levirules



Registered
  27/09/2008
Points
  37
2nd September, 2009 at 03:35:04 -

Indeed. It's one of the things that makes MMF easier, although I find myself creating more complex code to replace what MMF tries to hide from us.

In a normal programming language, you would have to do a "For every [object]" loop, perform a check, and execute code, all just to find something out about one object. So, in MMF, you have something like this:

If bullet is overlapping enemy: destroy enemy

If you have 4 enemies on the screen, and the bullet is overlapping one enemy, what MMF will do is create a list of all active objects, including the bullet and all 4 platforms. It will determine which enemy the bullet is overlapping, and take all of the enemies NOT overlapping the bullet off of the list. Therefore, it will only destroy the one enemy left on the list.

In real programming, every instance of an object has an index value. To accomplish this, you would have to write something like the following to pick which enemies have a bullet overlapping them:

For each bulet:
For each enemy:
If bullet is overlapping enemy: destroy enemy
End for
End for

You would have to write code that cycles through each bullet and each enemy (and you would have to write code to see the overlap too, unless the API includes an overlap function) in order to specify which is overlapping which.

As a side note, MMF doesn't destroy active objects until after all of the events have been checked and run. The advantage of a normal programming language here is that it would destroy them immediately.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click