The Daily Click ::. Forums ::. Klik Coding Help ::. MMF 2 Setting values for several instances of the same object individually
 

Post Reply  Post Oekaki 
 

Posted By Message

Liam Leeman



Registered
  29/01/2008
Points
  7
7th February, 2008 at 01:14:38 -

Hello there,

currently I'm coding an event-based and completely custom platform engine which also includes elevators and horizontally moving platforms. The movement of the latter two is calculated using values which I store inside these active objects. Now for my problem: If I copy my elevator object several times and spread the newly created elevators all over the level, each of them seems to change values for every other instance of the elevator as well, causing the movement calculations to screw up. An example: elevator 1 collides with the background requiring it to change it's movement direction from upwards to downwards. However, all the other elevators then also change their movement direction from upwards to downwards at the same moment even though it isn't their time to do that yet. Same goes for setting an initial speed: if I change the respective value in one elevator, it gets instantly changed in all the other elevators, too. I hope you got an idea of the issue...

Now I wonder if there is a way to set values for several instances of the same object individually which would put an end to this misery. Your input on this matter is highly appreciated.

Thanks a bunch in advance.

Love + peace

mrleeman

 
n/a

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
7th February, 2008 at 01:41:29 -

Use the event: Spead Value. It gives each instance its own value.
Then do a fast loop the number of instances,
and then you can test each object individually during the loop

 
-

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
7th February, 2008 at 01:43:43 -

Dines wrote a really good article about it here
http://www.create-games.com/article.asp?id=1798

If this doesn't help, and you don't mind,
I'll look at it if you upload the sourcefile

Image Edited by the Author.

 
-

Liam Leeman



Registered
  29/01/2008
Points
  7
7th February, 2008 at 01:59:20 -

Brilliant hint, Ricky! I've already fixed it and everything's working smoothly now. Thanks a bunch!!!

mrleeman

Image Edited by the Author.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click