Just a little help please

BlitzMax Forums/BlitzMax Beginners Area/Just a little help please

Type Vector
	Field X
	Field Y
	Function Create:Vector(X,Y)
		Local V:Vector
		V:Vector=New Vector
		V.X=X
		V.Y=Y
		Return V
	End Function
End Type
 
Global ShipPos:Vector

ShipPos:Vector=Vector.Create(8,5)

 
DrawText (ShipPos.Y,12,24)




Can Someone tell me why I get an Error with this little piece of code.

Thanks,
Eric

This is not a working example - do you have all the code?

No, I just thought that this should print the Y Portion of the shippos Vector... Am I wrong in this assumption?

I am trying to test things. To see how they work.

This seem's to work fine and you cannot use DrawText without Graphics command you would have to use

Print ShipPos.Y

prints to the debugger.

Oh duh!! Thanks

That is what I was asking too ;-) Cool, you're on your way.

Also, you if you want to use DrawText you need to use Flip to bring everything into view. The following is your code every so slightly condensed and corrected so that you can see the results.

Type Vector
	Field X
	Field Y
	Function Create:Vector(X,Y)
		Local V:Vector=New Vector
		V.X=X
		V.Y=Y
		Return V
	End Function
End Type
 
Global ShipPos:Vector=Vector.Create(8,5)

Graphics 400,300,0
DrawText (ShipPos.Y,12,24)
Flip
WaitKey

Functionally, nothing has changed, as yours works just fine.