I snatched this code from a project I'm working on.
sync on
sync rate 0
autocam off
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
print "Howdy, this is a hexagon"
sync
imgHexagon = New_Image()
get image imgHexagon, 0, 0, 150, 150
objHexagon = Make_Hexagon(20.0, imgHexagon)
position camera 1, 100, 1
point camera 0, 0, 0
do
turn object left objHexagon, 0.1
sync
loop
end
function Make_Hexagon(Size, ImgNumber)
HexPointOffsetx# = sin(30) * size
HexPointOffsety# = cos(30) * size
nwX# = -HexPointOffsetx#
nwY# = HexPointOffsety#
neX# = HexPointOffsetx#
neY# = HexPointOffsety#
wX# = -Size
wY# = 0.0
eX# = Size
eY# = 0.0
swX# = -HexPointOffsetx#
swY# = -HexPointOffsety#
seX# = HexPointOffsetx#
seY# = -HexPointOffsety#
memBlockSize = 12 + (3 * 6 * 32)
memBlockVerts = 18
tempMemblock = New_Memblock()
make memblock tempMemblock, memBlockSize
write memblock dword tempMemblock, 0, 274
write memblock dword tempMemblock, 4, 32
write memblock dword tempMemblock, 8, memBlockVerts
pointer = 12
Write_New_Memblock_Triangle(tempMemblock, pointer, x#, y#, z#, nwX#, y#, nwY#, neX#, y#, neY#, 0.5, 0.5, 0.25, 0.067, 0.75, 0.067): inc pointer, 96
Write_New_Memblock_Triangle(tempMemblock, pointer, x#, y#, z#, neX#, y#, neY#, eX#, y#, eY#, 0.5, 0.5, 0.75, 0.067, 1.0, 0.5): inc pointer, 96
Write_New_Memblock_Triangle(tempMemblock, pointer, x#, y#, z#, eX#, y#, eY#, seX#, y#, seY#, 0.5, 0.5, 1.0, 0.5, 0.75, 0.933): inc pointer, 96
Write_New_Memblock_Triangle(tempMemblock, pointer, x#, y#, z#, seX#, y#, seY#, swX#, y#, swY#, 0.5, 0.5, 0.75, 0.933, 0.25, 0.933): inc pointer, 96
Write_New_Memblock_Triangle(tempMemblock, pointer, x#, y#, z#, swX#, y#, swY#, wX#, y#, wY#, 0.5, 0.5, 0.25, 0.933, 0.0, 0.5): inc pointer, 96
Write_New_Memblock_Triangle(tempMemblock, pointer, x#, y#, z#, wX#, y#, wY#, nwX#, y#, nwY#, 0.5, 0.5, 0.0, 0.5, 0.25, 0.067): inc pointer, 96
tempMesh = New_Mesh()
ObjID = New_Object()
make mesh from memblock tempMesh, tempMemblock
make object ObjID , tempMesh, ImgNumber
delete mesh tempMesh
delete memblock tempMemblock
endfunction ObjID
function Write_New_Memblock_Triangle(wMemblock, pointer, x1#, y1#, z1#, x2#, y2#, z2#, x3#, y3#, z3#, u1#, v1#, u2#, v2#, u3#, v3#)
write memblock float wMemblock, pointer + 0, 0.0
write memblock float wMemblock, pointer + 4, 0.0
write memblock float wMemblock, pointer + 8, 0.0
write memblock float wMemblock, pointer + 12, 0.0
write memblock float wMemblock, pointer + 16, 1.0
write memblock float wMemblock, pointer + 20, 0.0
write memblock float wMemblock, pointer + 24, u1#
write memblock float wMemblock, pointer + 28, v1#
inc pointer, 32
write memblock float wMemblock, pointer + 0, x2#
write memblock float wMemblock, pointer + 4, y2#
write memblock float wMemblock, pointer + 8, z2#
write memblock float wMemblock, pointer + 12, 0.0
write memblock float wMemblock, pointer + 16, 1.0
write memblock float wMemblock, pointer + 20, 0.0
write memblock float wMemblock, pointer + 24, u2#
write memblock float wMemblock, pointer + 28, v2#
inc pointer, 32
write memblock float wMemblock, pointer + 0, x3#
write memblock float wMemblock, pointer + 4, y3#
write memblock float wMemblock, pointer + 8, z3#
write memblock float wMemblock, pointer + 12, 0.0
write memblock float wMemblock, pointer + 16, 1.0
write memblock float wMemblock, pointer + 20, 0.0
write memblock float wMemblock, pointer + 24, u3#
write memblock float wMemblock, pointer + 28, v3#
endfunction
function New_Image()
repeat
inc i
until image exist(i) = 0
endfunction i
function New_Object()
repeat
inc o
until object exist(o) = 0
endfunction o
function New_Mesh()
repeat
inc m
until mesh exist(m) = 0
endfunction m
function New_Memblock()
repeat
inc m
until memblock exist(m) = 0
endfunction m
Hope it helps!
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.