Graphics 1024,768
Global Rocks:TList = New TList
Type ScreenObject
Field X:Int
Field Y:Int
Field XV:Float
Field YV:Float
Field Rotation:Float
Field RotationSpeed:Float
Field Image:Timage
Method Update() Abstract
End Type
Type Ship Extends ScreenObject
Function Create:Ship(XX,YY)
P:Ship = New Ship
P.Image:Timage=LoadImage("PlayerShip.Bmp")
SetImageHandle (p.Image,36,42)
P.X=Rand(1000)
P.Y=Rand(700)
Return P
End Function
Method Update()
SetRotation Self.Rotation
DrawImage (Self.Image,Self.X,Self.Y)
End Method
End Type
Type Rock Extends ScreenObject
Function Create:Rock(XX,YY)
R:Rock=New Rock
R.X=Rand(1024)
R.Y=Rand(768)
R.Rotation=Rand(360)
R.RotationSpeed=Rnd(5.0)
R.Image:Timage=LoadImage("Asteriod.bmp")
SetImageHandle (R.Image,64,64)
ListAddLast Rocks,R
Return R
End Function
Method Update()
Local Asteroid:Rock
For Asteroid=EachIn Rocks
Asteroid.Rotation:+1
If Asteroid.Rotation>360 Then Asteroid.Rotation=0
SetRotation Asteroid.Rotation
DrawImage (Asteroid.Image,Asteroid.X,Asteroid.Y)
Next
End Method
End Type
Player:Ship=Ship.Create(0,0)
For tt=1 To 50
Rock.Create(10,10)
Next
Repeat
Cls
SetBlend(alphaBlend)
Player.Update()
Rock.Update()
Flip
Until KeyHit(Key_Escape)
Identifier 'Update' Not Found... It happens at Rock.Update()
What am I doing Wrong?
Thanks,
Eric
Global Rocks:TList = New TList
Type ScreenObject
Field X:Int
Field Y:Int
Field XV:Float
Field YV:Float
Field Rotation:Float
Field RotationSpeed:Float
Field Image:Timage
Method Update() Abstract
End Type
Type Ship Extends ScreenObject
Function Create:Ship(XX,YY)
P:Ship = New Ship
P.Image:Timage=LoadImage("PlayerShip.Bmp")
SetImageHandle (p.Image,36,42)
P.X=Rand(1000)
P.Y=Rand(700)
Return P
End Function
Method Update()
SetRotation Self.Rotation
DrawImage (Self.Image,Self.X,Self.Y)
End Method
End Type
Type Rock Extends ScreenObject
Function Create:Rock(XX,YY)
R:Rock=New Rock
R.X=Rand(1024)
R.Y=Rand(768)
R.Rotation=Rand(360)
R.RotationSpeed=Rnd(5.0)
R.Image:Timage=LoadImage("Asteriod.bmp")
SetImageHandle (R.Image,64,64)
ListAddLast Rocks,R
Return R
End Function
Method Update()
Local Asteroid:Rock
For Asteroid=EachIn Rocks
Asteroid.Rotation:+1
If Asteroid.Rotation>360 Then Asteroid.Rotation=0
SetRotation Asteroid.Rotation
DrawImage (Asteroid.Image,Asteroid.X,Asteroid.Y)
Next
End Method
End Type
Player:Ship=Ship.Create(0,0)
For tt=1 To 50
Rock.Create(10,10)
Next
Repeat
Cls
SetBlend(alphaBlend)
Player.Update()
Rock.Update()
Flip
Until KeyHit(Key_Escape)
Identifier 'Update' Not Found... It happens at Rock.Update()
What am I doing Wrong?
Thanks,
Eric