The Daily Click ::. Forums ::. Klik Coding Help ::. Spread Values
 

Post Reply  Post Oekaki 
 

Posted By Message

Ryan▫S



Registered
  25/10/2003
Points
  161
9th April, 2004 at 04:04:46 -

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

 
Gah!

AS Filipowski



Registered
  29/02/2004
Points
  444
9th April, 2004 at 04:19:56 -

spreading values? sounds new to me!

Do you mean giving all the enemies health bars? You have to do that yourself ... I think...

 
I do not have a signature of my own

clwe



Registered
  17/12/2002
Points
  702
9th April, 2004 at 09:07:48 -

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.

Image Edited by the Author.

 
n/a

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
9th April, 2004 at 09:10:48 -

>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


I think that would work.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click