
-----------------------------------
Danjen
Sun Mar 25, 2007 9:56 pm

Help with a grid system
-----------------------------------
Okay, so I'm making a turn-based strategy RPG akin to Tactics Ogre (but without the glam  :roll: ), and I need a bit of help with the movement grid location system ... thingy. When you select a unit, the grid lights up according to the unit's movement stat value, and shows the maximum boundary for where that unit can move that turn. That's what I'm having problems with. I've determined that  (x+y) +/- m will be used in an if statement somewhere (but not sure where), where x and y is the unit's x and y locations, and m is its movement value. I just need a some help making it work though.

-----------------------------------
Danjen
Mon Mar 26, 2007 8:53 pm

Re: Help with a grid system
-----------------------------------
Hey, I my solved problem.

var locx, locy, move : int := 0
get locx
get locy
get move
cls

for y : 1 .. 15
    for x : 1 .. 20
        Draw.Box ((x - 1) * 32, (y - 1) * 32, x * 32, y * 32, 7)
    end for
end for

Draw.FillOval (floor ((locx - 0.5) * 32), floor ((locy - 0.5) * 32), 12, 12, 10)
Draw.Oval (floor ((locx - 0.5) * 32), floor ((locy - 0.5) * 32), 12, 12, 7)

for y : locy - move .. locy + move
    for x : locx - move .. locx + move
        if abs (locx - x) + abs (locy - y) 