hi. trying to code my first we thing in max.
What I am trying to do is just see how the inherits work.
What I have bellow is a type called SpaceObject, this has the common fields of x,y,velocity which are common to all space objects.
I then have a Star type which inherist SpaceObject.
The star type has afew thing for itself like Draw() count and Create.
But I seem to be having trouble either getting it to create and add to the list or drawing the star image to the screen.
I duno about the rest of you but I am finding it hard to do any sort of Debugin (Win32) .. I hope thats something thats going to get worked on.
Any help is welcome and thanks in advance.
What I am trying to do is just see how the inherits work.
What I have bellow is a type called SpaceObject, this has the common fields of x,y,velocity which are common to all space objects.
I then have a Star type which inherist SpaceObject.
The star type has afew thing for itself like Draw() count and Create.
But I seem to be having trouble either getting it to create and add to the list or drawing the star image to the screen.
I duno about the rest of you but I am finding it hard to do any sort of Debugin (Win32) .. I hope thats something thats going to get worked on.
Any help is welcome and thanks in advance.
' ' ' My First Blitz Max Prog!. ' ' Aim : To create some types with its own methods and functions. ' Aim : To use the new linked list system and understand it. ' ' ' ' ' Strict Global GFX_Width : Int = 800 Global GFX_Height : Int = 600 Graphics GFX_Width,GFX_Height,0 Incbin "star.bmp" Global StarImage = LoadImage("incbin::star.bmp") Global SpaceObjectList:Tlist = CreateList() Type SpaceObject Field pos_x : Int Field pos_y : Int Field Velocity : Int Method count:Int() Local ret:Int ret=0 For stars = EachIn SpaceObjectList ret:+1 Next Return ret End Method End Type Global SpaceObjects:SpaceObject Type Star Extends SpaceObject Function Create:star() Local Stars:star = New Star 'Stars.pos_x=Rand(1,800) 'Stars.pos_y=Rand(1,600) 'Stars.Velocity=0 SpaceObjectList.addlast Stars Return Stars End function Method Draw() DrawImage StarImage,100,100 End method Method count:Int() Local ret:int ret=0 For stars = EachIn spaceobjectlist ret:+1 next Return ret End method End Type Global Stars:star While Not KeyHit(KEY_ESCAPE) Cls If KeyHit(KEY_SPACE) Stars.create() End If FlushMem;Flip wend