How do you make one object out of a group follow a different object of a group? What I mean is, if there are 100 A objects and 100 B objects, I want each A object with 1 individual B object. I've tried to spread a value in both objects and do something like
Value A("A") = Value B("B") --> Set position of A at B(0,0)
but it always goes to only one B object. Can anyone help me with this?
Enemy AI (so I don't have to make multiple detectors) and a shadows (so I don't have to make multiple shadows and lights).
Edit: It sets the positions easily, but how do you calculations with it (i.e. if you wanted to calculate its size)?
Here's a nice tip. I once gave each enemy a shadow as a separate object, and managed to get them to link together very reliably. Here's what I did:
Upon the creation of the enemy (or the start of the frame, if the enemy is already there), create a shadow at 0,0(or whichever co-ordinates you want) from the enemy. Then, if a shadow is overlapping an enemy, set the shadow's position to 0,0(or whichever co-ordinates you want, again) from the enemy. This worked absolutely flawlessly for me, providing the shadow will always overlap the enemy.
The only problems with this method are:
If you wish the enemy to jump, obviously it would have to no longer overlap it's shadow. There are ways around this, the best one being to create a jump animation which leaves a blank space below the enemy down to where the shadow would be and either draw a single pixel which would be hard to see(black is usuall best since it will mostly blend in with the shadow), or to have that blank space and give it box detection(switch fine detection off).
Sometimes things go a bit screwed up if the enemy is off screen, so the best thing to do is either to change it's memory settings or to literally make a little bit of code so it instantly stops moving once it's off the screen.