BlitzMax Toolkit Stupid Error --HELP!

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
OmenFelix
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 59
Joined: Fri May 04, 2012 1:42 pm
Current Project: Arcadian Descent(C++, SDL, KOS)
Favorite Gaming Platforms: PS2, PC, XBOX, NDS
Programming Language of Choice: C/C++

BlitzMax Toolkit Stupid Error --HELP!

Post 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.
Last edited by OmenFelix on Sat May 05, 2012 10:56 am, edited 2 times in total.
Why not check out my game-development forum at: http://f1rel0ck.netai.net
Or my 2D RPG at: https://www.facebook.com/pages/Arcadian ... 6873806531
Image
Image
Image
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: BlitzMax Toolkit Stupid Error --HELP!

Post 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. :|
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
OmenFelix
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 59
Joined: Fri May 04, 2012 1:42 pm
Current Project: Arcadian Descent(C++, SDL, KOS)
Favorite Gaming Platforms: PS2, PC, XBOX, NDS
Programming Language of Choice: C/C++

Re: BlitzMax Toolkit Stupid Error --HELP!

Post 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.
Why not check out my game-development forum at: http://f1rel0ck.netai.net
Or my 2D RPG at: https://www.facebook.com/pages/Arcadian ... 6873806531
Image
Image
Image
Post Reply