My first Monkey Project almost working.

Monkey Forums/Monkey Programming/My first Monkey Project almost working.

Gamer(Posted 2012) [#1]
Hello. My first Monkey project is stuck with an error "Method 'Drawmap' cannot be accessed from here."

I know this is because i don't yet understand how to take different chunks of code (Classes) and tie them together properly. I'm still struggling with OOP in general.



Getting the image to show on the screen is the main goal. Later i will look into scrolling around the dungeon, any advice?


Goodlookinguy(Posted 2012) [#2]
Yeah, you will really need to learn OOP. It's not hard to understand, but may take a bit to get good at.

What's happening here is that you have a class called 'Game' that you make an instance of and initialize, but don't attach to a variable.
New Game

Then you attempt to call a method from the class, which cannot be accessed. It can only be accessed from an object that's an instance of that class.
Game.Drawmap(ActiveMap.Mapcontent)


From what I can see (I didn't test anything), that's the likely cause of that particular error.


AdamRedwoods(Posted 2012) [#3]
re-arranged



Gamer(Posted 2012) [#4]
Thanks allot too both of you. I never thought about moving the Mapclass instance into the Field of Game Class. Seems like a really good idea, there are so many options with OOP it's really cool.