I'm doing a game (in xna) on my free time, as I'm not in the game market, I'm pretty sure I'm missing something that would help me get this right. Think of Ogre Battle. A group of unit moves, and when they cross enemy, a small automatic Final fantasy battle starts for 2 or 3 round.
I'm struggling on how I should place the creatures in the combat screen. A fight started. (final fantasy rpg battle ) The creatures part of this group needs to be positionned in a 16x16 grid. Some creatures are bigger and use larger than 1x1 square.
I create a class called group to represent groups of creature walking around. So far, I decide to put in an array of 4x4 representing the grid. How do I go around and position all the creatures on that grid and make sure they arent stepping on top of each other ?
some pseudo code I have right now :
Class Group
array(4,4) of rectangle
array(4,4) of creature
Public sub Update()
adjustCreaturePosition
end sub
End class
Class Creature
CombatValue as List of Enum.Qualities
PreferedPosition as Enum.Position
Range as smallint( 1 = melee, 2 = small range, 3 = long range)
End Class
Public Enum Position
Front
Middle
Back
End Enum
Public Enum Qualities
Melee
Armored
Strengh
Dodge
Siege
SmallRange
DPS
Nuker
Controller
Buffer
Dex
Int
Sick
Weak
End Enum
In the update of the group class , I need to create a function to set the position of all creatures when the combat starts.
Private Sub AdjustCreaturePosition()
' check the "prefered position" of all creep ( front, middle, back).
' if there are no more spot left for a creature, I need to check which creature is moved to the middle row based on A. if one of the creature on the front row will be able to attack on middle row ( based on the range ). If no unit can attack from the middle row, the weaker one is send on the back ( the sum of their combatValue list)
Next
End Sub
I got no idea how I'll do the AdjustCreaturePosition in a smart way yet. but lets say it works. Where I'm at a loss is how should I handle large creature who needs a 2x2 grid ?