I'm trying to create a bouncing ball, and so I have an object ball of Type football with three integer fields x, y and z (for position), and want to know if it's possible to include a type field (movement), of type Vector (which has the fields x, y and z)
Blitz 3D seems to accept this until I try to access the fields of the vector using ball\movement\x, it tells me that the object has not been created.
Am I doing anything wrong, or is it just not possible?
I can't use graphic-specific commands because the code has to work without graphics.
Type Vector
Field X#, Y#, Z#
end type
Type Football
Field X, Y, Z
Field vVelocity.Vector
end type
function CreateFootbal.Football()
F.Football = new football
F\vVelocity = new vector
return F
End Function
Here is some of my code that uses types within types:
;----------
; tile type to track terrain tiles
Type BFL_TerrainTile
Field v0.BFL_Vertex
Field v1.BFL_Vertex
Field v2.BFL_Vertex
Field v3.BFL_Vertex
End Type
; vertex type with position and texture coordinates
Type BFL_Vertex
Field x# ; coords
Field y#
Field z#
Field set0.BFL_TextureUV
Field set1.BFL_TextureUV
End Type
; texture coordinates type to track UV
Type BFL_TextureUV
Field u#
Field v#
End Type
;----------
And some code that accesses it:
;----------
; vertex v0
BFL_TerrainMatrix(tileX, tileY)\v0 = New BFL_Vertex
BFL_TerrainMatrix(tileX, tileY)\v0\x = (tileX * BFL_TILESIZE)
BFL_TerrainMatrix(tileX, tileY)\v0\y = (tileY * BFL_TILESIZE)
BFL_TerrainMatrix(tileX, tileY)\v0\z = 0.0
BFL_TerrainMatrix(tileX, tileY)\v0\set0 = New BFL_TextureUV
BFL_TerrainMatrix(tileX, tileY)\v0\set0\u = 0.0
BFL_TerrainMatrix(tileX, tileY)\v0\set0\v = 1.0
BFL_TerrainMatrix(tileX, tileY)\v0\set1 = New BFL_TextureUV
BFL_TerrainMatrix(tileX, tileY)\v0\set1\u = 0.0
BFL_TerrainMatrix(tileX, tileY)\v0\set1\v = 1.0
oops, RealityShattered beat me...