Null object access error

Monkey Forums/Monkey Programming/Null object access error

c.k.(Posted 2011) [#1]
I'm a new user and for now am just experimenting with Monkey, putting it through its paces, seeing what it can do...

The program below compiles fine but produces the following error in Firefox and Chrome:

Null object access
C:/Users/c.k.lester/Documents/MonkeyPro41/modules/mojo/graphics.monkey<429>
Y:/Game Projects/Monkey/Finger Drumming/graphics_test.monkey<17>
C:/Users/c.k.lester/Documents/MonkeyPro41/modules/mojo/app.monkey<72>

Here is the simple program (which I got from a tutorial) that causes the error:



If I comment out line 9 (SetUpdateRate 60), I don't get the error message, but I still don't see the image.


c.k.(Posted 2011) [#2]
Got it working. My test program is in the same folder as another test program and I didn't create a .data directory for the new test monkey program. Oops.


Dima(Posted 2011) [#3]
Maybe flower.png isn't loading correctly. Where is the image located relative to .monkey file that gets compiled? Resources must be inside .data folder, and the folder has to be named same as the compiled project file.

MyGame.monkey <- main project file which gets compiled
MyGame.data <- folder has to have same name as project, resources go here
MyGame.build <- monkey makes this folder automatically

edit: never mind you figured it out already


Jesse(Posted 2011) [#4]
the SetUpdateRate tell the program how often to call the OnRender method so if you don't use initialize SetUpdateRate it will never call OnRender.

did you make a folder name "graphics_test.data"? that is where all of your assets go and must be included in the main folder of your game. the folder must be the same name as your application with the extension "data".
if you didn't and you do that now, make sure you delete the build folder before compiling it with the newly created folder otherwise the new folder will not be included in the game and will produce the same results. also make sure the capital and non capital letters match for the image file

[edit]
way late to the party. :)


c.k.(Posted 2011) [#5]
Thanks for chiming in guys! I'll have more questions, I'm sure... :D