"Linking" objects together
My player is seperated into a number of different objects, including a collision object and two seperate animation objects which are all drawn in the same spot on game. They move with eachother, interact with eachother etc...
Anyway, I want to do the same for enemies. The problem is that there is more than one enemy and I have no idea how to tell the seperate objects to be "unified" if you know what I mean.
Any ideas?
Re: "Linking" objects together
Firstly, make sure you have the same number of objects as you do enemies, either by placing them down in the playfield or by using events (if number of objects < number of enemies: create object, if number of enemies > number of objects + pick object at random: destroy), then use your standard "set position to 0,0 from object", and thanks to the genius of MMF, it'll have one set to each enemy :)
If you want to use detection from each of these, though, you want to go a little bit more complicated, where you use a 'spread value'. Basically, the spread value function deals out a different number into an alterable value for each object of that type, in the order they were created (or the how far back they are if you rearranegd their order in the frame). So, you would do this:
Start of Frame: Spread value 1 in Alterable Value A of Object, Spread value 1 in Alterable Value A of Enemy.
You might want to rename Alterable Value A to, let's say, ID.
So then you'd do this:
ID of Object = ID of Enemy: Set Object position to 0,0 from Enemy.
That way, each object will be attached to each enemy with the same ID (Alterable Value A) as it.
Then, you can use detection, for example, if the Object has made a collision, and you want to destroy the Enemy that object is attached to, you'd then do this:
Object collides with (whatever you choose) + ID of Object = ID of Enemy: Destroy Object adn Enemy.
Does this make sense? Sorry if it's complicated.