The Daily Click ::. Forums ::. Klik Coding Help ::. Unit Positioning
 

Post Reply  Post Oekaki 
 

Posted By Message

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
9th December, 2013 at 09/12/2013 04:21:35 -

Hey team!

I've mentioned previously that I'm working on a tabletop strategy game in MMF, and I'm struggling to prod my mind into working around this little foible.

It's turn based and how I have it working is one object represents the SQUAD, and that squad object will have UNIT objects that are the actual representation of the little dudes linked to it. So for example, SQUAD 1 might have a population of 10, so you will have Squad 1 Units 1-10..., plus the Squad object itself for a total of 11 objects. Yeah you get it.

Anyway, all the movement is based off the SQUAD object. So let's say I want to move up the board, I click and drag the SQUAD object until it's out of move points or hits it's max distance etc. Then, I run a command that tells the UNITS to re-position themselves based on the new X/Y of the SQUAD they belong to, picking a random coordinate within x of Squad.

The breakdown:

IF - [UNIT] Alt Val D* is GREATER than [X]
THEN - Set [UNIT] X to X( "PAI Squad1" )+(Cos(Random(360))*(Random(70)-35))
- Set [UNIT] Y to Y( "PAI Squad1" )+(Sin(Random(360))*(Random(70)-35))

It will also execute those commands when UNIT is overlapping objects with a Obstacle qualifier.

There is also another command that tells it to shift a few pixels in a random direction if two units of the same squad are overlapping.

It is MEANT to execute those commands when UNIT is overlapping the Qualifier Neutrals, however more on that later.




That command is ugly and brute force and I would like something a little slicker, however I'm not sure where to start. At the moment it will just flash and nudge them all around and look quite horrible as the units are all battling to occupy limited positions. Ideally, I would like it to look like this:

SQUAD moved.
Determine new positions for Units
Move units into new coordinates.

I've thought about turning them transparent while they dance around, but that just seems messy and cheating and I'm sure there is a better way that has them move from Position A to B without showing the method of picking the coords. Any help or ideas would be greatly appreciated!

Cheers guys.

 
n/a

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
9th December, 2013 at 09/12/2013 07:05:18 -

Also, while I'm here and posting, does anyone know of a basic way to pick a given object with the lowest Alt Value?

I know there is the Select Object extension, but I'm wary of using extensions. No I don't really have a reason, some vague notion that they may prevent the game running on some PCs... And I've already got the Function Loop so in for a penny...


Anyway, is there anything to my paranoia? Or is there a basic way to pick an Object out of a lineup using the Alt Values? Thanks again!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click