Need Help Converting a Dungeon Gen to Max
BlitzMax Forums/BlitzMax Programming/Need Help Converting a Dungeon Gen to Max
| ||
Hi all. I am fairly new to Max, but have been using B2D for years. I have a nice dungeon generator written by someone else. I have gone through and tried to make it into a nice OO version to use with Max and am having some difficulty. I would appreciate if one of the gurus could show me how to do it properly. I have intentionally left out certain functions, but feel like I have the essentials in. I am going to be working on a roguelike in Max. Here is the original file: Here is my conversion: Thanks in advance for any input. |
| ||
I thing your problem is to understand the difernce bitween functions and Methods in types. Check the <User defined types> in the tree Help under Languge. What I can tell you in haste is that function does not recognise the fields of the objects and you may use them for the basic creation of the type. But Method recognise them. Check this out. Type TLike Field x:Int Field y:Int Function create:TLike( x:Int , y:Int) Local tmp:TLike = New TLike tmp.x = x tmp.y = y Return tmp End Function Method setXY( _x:Int , _y:Int ) x = _x y = _y End Method End Type Local Like:TLike = TLike.create( 10 , 10 ) Print Like.x Print Like.y Like.setXY( 14 , 25 ) Print Like.x Print Like.y Run this and be sure to read the Help docs under the IDE. The Language part it's really good. |
| ||
I see what you are saying. I did read the docs, but it looked to me like either one could access the types. I don't find the docs to be all that great personally. I think there are a few that agree with me :) |