Can't get basic image to load... please help!

Monkey Forums/Monkey Beginners/Can't get basic image to load... please help!

Corné(Posted 2016) [#1]
Running below gives me the following compile error: "Identifier 'loadimage' not found".

It looks like Monkey is not recognising a basic function like LoadImage.... could it be that Mojo is not properly imported...? Something else?

I've just installed the demo version of Monkey, so please forgive me if this is a real noob question. Thanks for any help offered!

========================= code below ===========
Import mojo

Class MyGame Extends App

Field board:image

Method OnCreate()
SetUpdateRate(60)

board = loadimage("MYZGA_Map.png")

End

Method OnUpdate()

End

Method OnRender()
Cls 128, 0, 255
DrawImage(board, 0, 0)

End
End

Function Main()

New MyGame

End


Corné(Posted 2016) [#2]
Problem solved! It turns out that Monkey is very case sensitive and all the reserved keywords (like the LoadImage function and Image type, need to be written with case sensitive in mind)... I thought the IDE would take care of this "mundane" task. Anyhoo... the same code runs fine now that I have fixed all the case sensitive keywords.


chrisbck(Posted 2016) [#3]
Yeah the Ted IDE is pretty basic but simplicity can be a good thing and I find it discourages lazy programming. That being said I'm currently trialling the demo versions of Jungle and Mollusk, they both correct case sensitivity and have loads more useful features, you might want to check them out. I like them both but can't decide which one to go for yet.


ImmutableOctet(SKNG)(Posted 2016) [#4]
For the record, identifiers in Monkey are case sensitive, whereas keywords are not. Since 'LoadImage' is a function, it isn't a "reserved keyword", so it follows the same rules your own code does.

In Monkey, you could easily have functions called 'loadimage', 'loadImage' and 'LoadImage' all be present without name conflicts. The same goes for local identifiers like variable names and the like.


Corné(Posted 2016) [#5]
Thanks for the additional insight guys! It's time for me to to trial some IDE's methinks... :-)