Space Invaders... Using an array for X and Y Of Enemies :?
Author |
Message |
[Flame][Boy]
|
Posted: Thu Jan 19, 2006 10:03 am Post subject: Space Invaders... Using an array for X and Y Of Enemies :? |
|
|
Hey guys im making a copy of space invaders and i need to know how to set the x and y value of my enemies using an array like i have an array of 1..20 and i need to set different x and y values for all 20 is that possible |
|
|
|
|
|
Sponsor Sponsor
|
|
|
zylum
|
Posted: Thu Jan 19, 2006 11:09 am Post subject: (No subject) |
|
|
Use records.
code: |
type Position:
record
x, y : int
end record
var badies : array 1..20 of Position
for i : 1..20
badies(i).x := i*100
badies(i).y := maxy-200
end for |
[mod:85b5970787="Delos"]
Just fixing a few typos in the code...
Carry on.
[/mod:85b5970787] |
|
|
|
|
|
Drakain Zeil
|
Posted: Thu Jan 19, 2006 6:04 pm Post subject: (No subject) |
|
|
Also, if you're looking to abuse the ability of poor programming, don't forget that arrays can have many dimentions...
var a:array 1..20, 1..2 of int
% 1..20 indicates unit, 1..2 is either the x or y axis.
But, you should use records instead, as already said. |
|
|
|
|
|
|
|