problem with using fielded variables

BlitzMax Forums/BlitzMax Beginners Area/problem with using fielded variables

yzzm(Posted 2009) [#1]
when i attempt to access a fielded variable, i get an error saying that the identifier doesn't exist.

Type Character

field health

end type

Print Character.health

then i receive an error, anyone know why this is happening?


Perturbatio(Posted 2009) [#2]
if you haven't created an instance of the class, the field won't exist. If you want to access it without an instance, then declare it as global (it will then have the same value across all instances which is probably not what you want with a character's health).

Type Character
	Field Health
End Type

Local player1:Character = new Character
print player1.health