Just a little help please

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

Eric(Posted 2005) [#1]
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


StuC(Posted 2005) [#2]
This is not a working example - do you have all the code?


Eric(Posted 2005) [#3]
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.


Sarge(Posted 2005) [#4]
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.


Eric(Posted 2005) [#5]
Oh duh!! Thanks


StuC(Posted 2005) [#6]
That is what I was asking too ;-) Cool, you're on your way.


JazzieB(Posted 2005) [#7]
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.