Monkeynizing my game - some findings
Community Forums/Monkey Talk/Monkeynizing my game - some findings
| ||
(oooh... forum bug that moved this reply to be the first in the thread after Edit. Odd!) Last edited 2011 |
| ||
Here's some findings after I've started monkeynizing my 2D game that I made some time ago. (Game screenies link: http://www.gameproducer.net/pre-order-dwarf-game/ ) --------------------------------------------------- FINDINGS: I use STRICT always. File names setup: - Change file names (.bmx => .monkey) Folder structure: (Didn't test this yet... so correct if wrong!) - yourgame/ - yourgame/myGameApp.monkey <--- file name is important! - yourgame/character.monkey - yourgame/whatnot.monkey - yourgame/myGameApp.data/ <-- assets go here - yourgame/myGameApp.data/images/dwarf.png <-- see also #12, scroll down - yourgame/myGameApp.data/levels/stuff/ <-- sub directories can be done this way Then inside files: 1) SuperStrict => Strict 2) import "file.bmx" => import file 3) LOCALS outside classes need to be turned to GLOBALS 4) AppTitle => 'AppTitle (comment away) 5) Type => Class 6) Functions inside classes => Method 7) static/singleton classes work: (hanks therevills) Class TCharacterHandler Function update:Void() Print "WORKS" End End TCharacterHandler.update() 8) Methods need to have return values... or declared void always: Method WontWork() End ... Method Works:Int() return 0 End ... Method WorksToo:Void() '<-- use this, thanks ziggy End 9) Rem ........... End Rem => #rem .......... #end 10) If you get "couldn't find identifier", it might be case-sensitive issue. Make sure it's "Print" and not "print" compilation error messages are bit crappy at the moment, so most likely there's typo or you type something wrong. "endclass" or "EndClass" should be "End Class". 11) Debuglog => Print (sort of) 12) LoadAnimImage("../images/dwarf.png", 18, 18, 0, 2) => LoadImage("images/dwarf.png", 2) Check LoadImage for more details on how to use this. Also ensure Folder structure is ok. ("mygamefolder/mygame.data/images/dwarf.png") 13) Error handling: RuntimeError "doesn'twork" Error "Works!" --------------------------------------------------- CONTINUES... Adding more tips as I go through the piles of .bmx code Last edited 2011 Last edited 2011 Last edited 2011 Last edited 2011 Last edited 2011 |
| ||
good list laddie |
| ||
I havent found it yet, but is there a hideCursor command in Monkey? |
| ||
methods do not have to return values always. You can declare a method void.Class MyClass Method Draw:Void(value1:String) End End |
| ||
@ziggy: perfecto. Thanks! |
| ||
Nice list, thanks. |
| ||
Nice list, thank you :) |
| ||
Thanks for the list! For the singleton class, can't you just use Static on the update method and also Static on any variable declarations that it uses so that you don't need to instantiate it? I haven't used monkey yet but I know this works in other languages. Last edited 2011 |
| ||
You still can do this:Function Main:Void() Print "Just Monkey Code" Test.work() End Function Class Test Function work:Void() Print "WORK" End End Looks like Static isnt a keyword. Here is a list of keywords for Monkey: void strict public private property bool int float string array object mod continue exit include import module extern new self super eachin true false null not extends abstract select case default const local global field method function class and or shl shr end if then else elseif endif while wend repeat until forever for to step next return interface implements inline Last edited 2011 |
| ||
I stand corrected... and editing my posts. Singleton/static seems to work indeed. Last edited 2011 |
| ||
OK good to know thanks! |
| ||
Be aware that you should use the return type Int for Main and the Mojo.app overidden functions to ensure cross-platform code! http://www.monkeycoder.co.nz/Community/posts.php?topic=135 |
| ||
4) AppTitle => 'AppTitle (comment away) Hey gameproducer, what do you mean with the AppTitle? Looking at the mojo code I thought you had to override it, something like this: Method AppTitle$() Return "TEST" End Method But this doesnt work... |
| ||
stupidest question/idea at launch-time... The idea is to change the Monk-IDE to 'strict-ize' all the function/methods/vars found in the source code: you write normally, the *before* run/debug the IDE saves a temp.source.file, converts/adds everything necessary (:int, :void, return 0 and so...), save the file, compile and execute the 'new file'. I suppose monk-source code is available in the maxgui fork so something should be possible...mmhmmhmmmh something to do this weekend - but honestly I want to play with monkey :) back in thread: interesting discoveries, thanks Gameproducer! |
| ||
The idea is to change the Monk-IDE to 'strict-ize' all the function/methods/vars found in the source code that would be luvly how about an option to add all that stuff permanently? (i.e.re-write the users source code) |