I do know that the Alien Ship is not loading the image and I trying to load the Alien image on the screen.
What I am doing wrong?
SuperStrict
' -----------------------TYPES-----------------------------
Type ShipType
Field X:Int,Y:Int=500 'For Player
Field Image:TImage
Field Speed:Int =5 'Speed for Player
Field BX:Int,BY:Int=450 'Bullets
Field EX:Int,EY:Int 'Enemys - not done yet
Function Create:ShipType(File:String,xstart:Int,ystart:Int)
Local Ship:ShipType = New ShipType
Ship.X=xstart
Ship.Y=ystart
Ship.Image=LoadImage(file)
If Ship.Image=Null
Print "Not able to load image file. Program aborting"
End
EndIf
Return Ship
End Function
Method Draw()
DrawImage Image,X,Y
End Method
Method Move()
If KeyDown(Key_Right) Then X:+Speed
If KeyDown(Key_Left) Then X:-Speed
'If KeyDown(Key_Up) Then Y:-Speed
'If KeyDown(Key_Down) Then Y:+Speed
' Collisions for Wall on each side to stop
' Player going off the playing area!
If X<0 Then X=0
If X>770 Then X=770
End Method
End Type
Type TAlienShip
Field X:Int = 320
Field Y:Int = 0
Field Speed:Int=3
Field Image:TImage
Function Create:TAlienShip(File:String,xstart:Int,ystart:Int)
Local Alien:TAlienShip=New TAlienShip
Alien.X=xstart
Alien.Y=ystart
Alien.Image=LoadImage(LoadBank(File))
If Alien.Image=Null
Print "Not able to load image file. Program aborting"
End
EndIf
Return Alien
End Function
Method UpdateState()
X :- Speed
If X<-ImageWidth(Image) Then X=620
End Method
Method DrawSelf()
DrawImage Image,X,Y
End Method
End Type
Local myShip:ShipType = ShipType.Create("gfx/blobship.png",400,300)
Local Alien:TAlienShip = TAlienShip.Create("Gfx/cartoonufo_1-1.png",320,0)
' ---------------SETUP GAME CONDITION---------------
Graphics 800, 600, 0
HideMouse
' ---------------------MAIN LOOP-------------------------
While Not KeyDown(Key_Escape)
Cls
myShip.Draw
myShip.Move
Alien.UpdateState()
Alien.DrawSelf()
Flip
Wend
|