Thanks :)
A example of what i can do in C#, but no idea how in BlitzMax is the following example:
1. Create a class clsMain
2. create class clsEnemy.
3. Instantiate a enemy in clsMain.
4. Set a property such as <enemyobject>.PosX+=1;
5. then in a clsMain loop, waiting for keypress ESC, I do
<enemyobject>.Update();
5.1 Inside of <enemyobject>.Update() i read the property of PosX then do a Drawxxxxx position update.
Sounds like a simple task if you know how ;)
Side note:
1. Variables can not contain < or > (I do not think that was what you meant, but just in case that is possible in C :)
2. You can use [a http://fullnameoflink...]Click Here[/ a] to make links on this forum.
TLists
Most time I would use the built-in Tlists for the above job, here is an example that extends the above:
A example of what i can do in C#, but no idea how in BlitzMax is the following example:
1. Create a class clsMain
2. create class clsEnemy.
3. Instantiate a enemy in clsMain.
4. Set a property such as <enemyobject>.PosX+=1;
5. then in a clsMain loop, waiting for keypress ESC, I do
<enemyobject>.Update();
5.1 Inside of <enemyobject>.Update() i read the property of PosX then do a Drawxxxxx position update.
Sounds like a simple task if you know how ;)
clsMain.MainLoop() ' <--- You must call this manually, I think main is always run automatically in C Type clsMain Function MainLoop() Graphics 300,300,0 'DebugWindowMode Print "Game Started" ' Instantiate Enemy Local Enemy:clsEnemy Enemy = New clsEnemy While Not KeyDown(Key_Escape) Enemy.Update() Flip;Cls ' Flips buffers (you draw to the backbuffer), Cls clears the Frontbuffer. Wend Print "Game Over" End EndFunction EndType Type clsEnemy Field X,Y = 150 'Default Values, If not set then = 0 Method Update() X:+1 DrawOval X,Y,10,10 EndMethod EndType
Side note:
1. Variables can not contain < or > (I do not think that was what you meant, but just in case that is possible in C :)
2. You can use [a http://fullnameoflink...]Click Here[/ a] to make links on this forum.
TLists
Most time I would use the built-in Tlists for the above job, here is an example that extends the above:
clsMain.MainLoop() ' <--- You must call this manually, I think main is always run automatically in C Type clsMain Global Enemies:TList = CreateList() 'This List is created when the program compiles because it is a global Function MainLoop() Graphics 300,300,0 'DebugWindowMode Print "Game Started" ' Instantiate some Enemies For Local n = 0 To 200 New clsEnemy Next While Not KeyDown(Key_Escape) clsEnemy.UpdateAll() Flip;Cls ' Flips buffers (you draw to the backbuffer), Cls clears the Frontbuffer. Wend Print "Game Over" End EndFunction EndType Type clsEnemy Field X = Rand(-300,0) Field Y = Rand(10,290) Method New() ' Add this enemy to a list in clsMain clsMain.Enemies.Addlast( Self ) EndMethod Function UpdateAll() For Local Enemy:clsEnemy = EachIn clsMain.Enemies Enemy.Update() Next EndFunction Method Update() X:+2 If X > GraphicsWidth() Then X = 0 DrawOval X,Y,10,10 EndMethod EndType