Dear Community,
I am just beginning to program with B3D. My goal is to create a maze with 25 rooms. I have the composed the rooms of inside walls, outside walls, and floors in order to texturize these parts separately. I bound all these meshes to a pivot calles 'RoomTmpl' which serves as a room template. Since all rooms will look basically look alike, I wanted to create a Type array with fields specifying the coordinates (where to put the room in space) and other items defining the rooms. I thought a Type array would allow me to loop over it in a For-loop and is thus a efficient way to update the rooms.
Thus, I wanted to do something like the following:
Type RoomProps
Field Name
Field Wall ; this is for holding the handle
Field x#, y#, z#
EndType
Dim Room.RoomProps(25)
For i = 1 To 25
Room(i) = New RoomProps
Room(i)\Name = MyNames$(i)
Room(i)\Wall = CopyEntity(RoomTmpl)
Room(i)\x# = Xcoord#(i)
Room(i)\y# = 0
Room(i)\z# = Zcoord#(i)
PositionEntity Room(i)\Wall,Room(i)\x#,Room(i)\y#,Room(i)\z#
Next
However, when I checked for errors I got the error message "Expecting 'NEXT' statement" (or something like that). I guess I cannot simply assign an Entity to a field in a Type (I do not get any line number associated with
the error - is there way to turn this on in B3D?).
However, I also tried this:
...
Room(i)\wall = handle(CopyEntity(RoomTmpl))
...
but I got the same error message.
Now, is it actually possible to save handles in a Type field? Or should I rather create an array of handles, e.g. Dim RoomHdl(25)? And if that is possible, what type does this array have? Integer? Or is this just the wrong approach to begin with?
Thanks for your help!
I am just beginning to program with B3D. My goal is to create a maze with 25 rooms. I have the composed the rooms of inside walls, outside walls, and floors in order to texturize these parts separately. I bound all these meshes to a pivot calles 'RoomTmpl' which serves as a room template. Since all rooms will look basically look alike, I wanted to create a Type array with fields specifying the coordinates (where to put the room in space) and other items defining the rooms. I thought a Type array would allow me to loop over it in a For-loop and is thus a efficient way to update the rooms.
Thus, I wanted to do something like the following:
Type RoomProps
Field Name
Field Wall ; this is for holding the handle
Field x#, y#, z#
EndType
Dim Room.RoomProps(25)
For i = 1 To 25
Room(i) = New RoomProps
Room(i)\Name = MyNames$(i)
Room(i)\Wall = CopyEntity(RoomTmpl)
Room(i)\x# = Xcoord#(i)
Room(i)\y# = 0
Room(i)\z# = Zcoord#(i)
PositionEntity Room(i)\Wall,Room(i)\x#,Room(i)\y#,Room(i)\z#
Next
However, when I checked for errors I got the error message "Expecting 'NEXT' statement" (or something like that). I guess I cannot simply assign an Entity to a field in a Type (I do not get any line number associated with
the error - is there way to turn this on in B3D?).
However, I also tried this:
...
Room(i)\wall = handle(CopyEntity(RoomTmpl))
...
but I got the same error message.
Now, is it actually possible to save handles in a Type field? Or should I rather create an array of handles, e.g. Dim RoomHdl(25)? And if that is possible, what type does this array have? Integer? Or is this just the wrong approach to begin with?
Thanks for your help!