Page 1 of 1

BlitzMax Toolkit Stupid Error --HELP!

Posted: Sat May 05, 2012 9:46 am
by OmenFelix
Hey you guys, I've decided to use BlitzMax for my game engine's toolkit and thus as a result I am experimenting with the Blitz language.

Through my endeavours my code has broken, with what seems to be a silly error, so now I consult the good people of ChaosRift for help with my primitive problems.

Here is the code:

Code: Select all

Main() 'invoke Main function

'DECLRATION CRAP --TYPE SHIT
Type TVec2d 'two-dimensional vector biatch
	Field X:Int
	Field Y:Int
End Type

Type TFrame
	Field Pos:TVec2d = New TVec2d 'position
	Field Siz:TVec2d = New TVec2d 'size --used for collision prob.
	Field Rot:TVec2d = New TVec2d 'rotation
	Field Sca:TVec2d = New TVec2d 'scale
End Type

Type TSprite
	Field Image:TImage = New TImage
	Field Body:TFrame = New TFrame
	Field Clip:TFrame = New TFrame
	
	Method ImageLoad(address:String)
		Image = LoadImage(LoadBank(address))
	End Method
	
	Method ImageRender()
		DrawImage(Image,Body.Pos.X,Body.Pos.Y)
	End Method
End Type

'TYPE-INSTANCE DECLARATIONS
Player:TSprite = New TSprite
'FUNCTION CRAP --CHECK FOR ALL THE CRAZY BULLSHIT
Function Main:Int()
	Init()
	While (True)
		Render()
		Flip() 'flip screen buffer
		Cls() 'clear screen
		Keyboard()
		Mouse()
	End While
	Return 0;
End Function

Function Init:Int() 'this function is run ONLY ONCE at the start of the program
	AppTitle = "Arcadian Descent Toolkit"
	Graphics(640,480,0)  'initialize screen size
	ShowMouse()
	Player.Body:TFrame.Pos:TVec2d.X = 100;
	Player.Body:TFrame.Pos:TVec2d.Y = 100;
	Player.ImageLoad("megaman.jpg")
	Return 0;
End Function

Function Render:Int() 'render graphics
	SetColor(255,255,255)
	DrawText("Mouse("+MouseX()+", "+MouseY()+")",0,0)
	SetColor(255,0,255)
	DrawRect(32,32,32,32)
	player.imageRender()
	Return 0;
End Function

Function Keyboard:Int() 'check for key presses
	If KeyHit(KEY_ESCAPE) Or AppTerminate() Then
		End
	End If
	Return 0;
End Function

Function Mouse:Int() 'check where the mouse is
	
	Return 0;
End Function
Here is the errors:
Identifier 'body' not found
...I just find that to be an amusing error. :lol:


Thanks in advance. :dreamcast:

EDIT: Updated code to apply with Blitz conventions.

Re: BlitzMax Toolkit Stupid Error --HELP!

Posted: Sat May 05, 2012 10:19 am
by Ginto8
I don't know BlitzMax, but every half-decent compiler ever will tell you which line the error occurs on. If you can show us what line(s) produce that error, we'll be much better off trying to help you.

In another language, I'd say you messed up what access level the member has, but a quick google search seems to indicate that all BlitzMax fields are public, so I can't be sure. :|

Re: BlitzMax Toolkit Stupid Error --HELP!

Posted: Sat May 05, 2012 10:55 am
by OmenFelix
Ginto8 wrote:I don't know BlitzMax, but every half-decent compiler ever will tell you which line the error occurs on. If you can show us what line(s) produce that error, we'll be much better off trying to help you.

In another language, I'd say you messed up what access level the member has, but a quick google search seems to indicate that all BlitzMax fields are public, so I can't be sure. :|
It doesn't give me a line number as BlitzMax doesn't display line-numbers for some reason. It does however indicate to me which lines. I edited the lines to this:

Code: Select all

Player.Body:TFrame.Pos:TVec2d.X = 100;
Player.Body:TFrame.Pos:TVec2d.Y = 100;
And now if I was to omit the ":TVec2d" after Pos I get the same error as before but for Pos. It seems that I've fixed the first error, but the solution seems to be different for this error as to what the first error's solution was. The current error is generated when I leave that code in:
Expecting expression but encountered ':'
NOTE: As you may see I've made most of the variables upper-case with the first letter and the types prefixed with a 'T' --to apply to Blitz conventions.