Help with a grid system
Author |
Message |
Danjen
|
Posted: Sun Mar 25, 2007 9:56 pm Post subject: Help with a grid system |
|
|
Okay, so I'm making a turn-based strategy RPG akin to Tactics Ogre (but without the glam ), 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. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Danjen
|
Posted: Mon Mar 26, 2007 8:53 pm Post subject: Re: Help with a grid system |
|
|
Hey, I my solved problem.
code: |
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) <= move then
Draw.Fill (floor ((x - 0.5) * 32), floor ((y - 0.5) * 32) - 3, 12, 7)
end if
end for
end for
|
Basically, I had to ensure that the x and y's difference didn't exceed the movement value.
But I have another problem.
I need to make a procedure that draw an isometric grid. It needs to be flexible enough so that it can accept the starting coordinates of the grid, repeats a user-defined number of times. I think the procedure would start out
proc DrawIsoGrid (x1, y1, x2, y2, c, x1_, y1_, x2_, y2_, c_, xrep, yrep : int)
for y: 1 .. yrep
for x: 1 .. xrep
. . .
end for
end for
end DrawIsoGrid |
|
|
|
|
|
ericfourfour
|
Posted: Mon Mar 26, 2007 11:25 pm Post subject: Re: Help with a grid system |
|
|
Danjen, you don't have to go through all of the trouble of colouring the text yourself, just use [syntax="turing"][/syntax]. It will do it for you. |
|
|
|
|
|
Danjen
|
Posted: Tue Mar 27, 2007 7:55 pm Post subject: Re: Help with a grid system |
|
|
I knew that, except that I thought it was [code=turing]... but when that didn't work in the preview I just thought I'd color it myself and hope no one noticed
But seriously though, I would like some help for this stupid line thing. |
|
|
|
|
|
Drakain Zeil
|
Posted: Thu Mar 29, 2007 6:05 pm Post subject: RE:Help with a grid system |
|
|
make a procedure to draw one square at XY coords, and loop through it as if you were drawing circles at changing positions.
Give it the arguments, (X,Y, Colour). |
|
|
|
|
|
|
|