using types in my space exploring game

Blitz3D Forums/Blitz3D Beginners Area/using types in my space exploring game

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

that's what types are for... but you should split all your "things" of the same context into their own types like so:

Const SYSTEM_MAXPLANETS = 9

Type system
	Field name$
	Field size#
	Field planet.planet[SYSTEM_MAXPLANETS]
End Type

Type planet
	Field name$
	Field size#
	Field system.system
End Type

s.system = New system
s\name = "Sol"
s\size = 1

s\planet[0] = New planet
s\planet[0]\name = "Mercury"
s\planet[0]\size = .054
s\planet[0]\system = s

s\planet[1] = New planet
s\planet[1]\name = "Venus"
s\planet[1]\size = .88
s\planet[1]\system = s

p.planet = s\planet[1]

Print p\name+" in the " + p\system\name + " system, is " + p\size + " the size of Earth."
WaitKey
End