Question about Types (B3D)

Blitz3D Forums/Blitz3D Programming/Question about Types (B3D)

This should help you ... not a fully working demo ..

Type Building
	Field x, y, z
	Field Otherstuff
End Type

Type Room
	Field ID.Building
	Field x, y, z
	Field Otherstuff
End Type

CHURCH.building = CREATEbuilding( 120 , 100 , 1800 )
room1.room = CREATEroom( CHURCH , 10, 10, 10 )
room2.room = CREATEroom( CHURCH, 150,10,80 )

;access info from the building that the room is in
Text 0,0,room1\ID\x
Text 0,10,room1\ID\y
Text 0,20,room1\ID\z


Function CREATEbuilding.Building( x, y, z )

	b.building = New building
	b\x = x
	b\y = y
	b\z = z
	
	Return b
	
End Function


Function CREATEroom.room ( b.building , x, y, z )

	r.room = New room
	r\ID = b
	r\x = x
	r\y  = y
	r\z = z
	
        return r

End Function