can someone upload an example file for MMF on spreading values.
I want to position skins on top of enmey colliders for a topview game.
I cant figure it out
I don't know of a tutorial for spreading values, but I can explain what it does. When you 'spread a value', you basically give each object (of one type) a unique number in one of it's alterable values.
As an example, lets say you spread a value through Alt. value A of 'Enemy' object, and set the starting number to be 0. The first object (the furthest to the front in view, I think) will have it's A value set to 0, and from then on the remaining enemy objects will be set to 1, 2, 3 etc. This gives each one a unique reference number, starting from 0 and increasing.
I'm not sure exactly what you want to do, but...as an example, if you want each enemy (of one type) to have a floor sensor, you would do the following:
Start of Frame: spread 0 in alt Value A for 'floor sensor', spread 0 in alt Value A for 'enemy'
Always: Start loop 0 for *amount of enemies* loops
If loop trigger # 0 AND value A of 'floor sensor' equals loop step AND value A of 'enemy' equals loop step: Set position of floor sensor *relative to enemy*
That may not be the best way of doing it (I wouldn't use 'always', for a start), but I know it works. Providing that there are the same amount of floor sensors as there are enemy objects, each one will now have their own floor sensor, following it wherever it goes. You will need the fastloop extension if you're using TGF. MMF, on the other hand, has fast loops built in.
>start of level
-spread value 1 in Enemy collider's value A
-spread value 1 in Skin's value A
>(any event where a new skin or enemy collider object is created)
-spread value 1 in Enemy collider's value A
-spread value 1 in Skin's value A
>always
-start loop 0 for (number of Enemy collider) loops
-set loop check counter to 0
>Loop 0:
-add 1 to loop check counter
>loop 0:
+>if value A of skin = loop check counter
+>if value A of Enemy collider = loop check counter
- set position of skin to (0,0) from Enemy collider