OK i need some help with this code, it wont work for some reason.
Const g_ScreenWidth=800, g_ScreenHeight=600 ; Call the BB "Graphics" routine to initialize DirectX
Graphics g_ScreenWidth, g_ScreenHeight,32,1 ; Set up BB to support page-flipping
SetBuffer BackBuffer()
TFormFilter Enable
Global bg_image1
bg_image1=LoadImage("bg.bmp")
Type player
Field shipframes
Field shipframe
Field shipx
Field shipy
Field shipdirection
End Type
player1.player=New player
player1\shipx=50
player1\shipy=50
player1\shipframes=LoadImage("ship1.bmp")
While Not KeyHit(1)
drawbg()
updateplayers()
drawplayers()
Flip
Cls
Wend
Function drawbg()
DrawImage bg_image1,0,0
End Function
Function updateplayers()
If KeyDown(17) Then ;W
End If
If KeyDown(30) Then ;a
End If
If KeyDown(31) Then ;s
End If
If KeyDown(32) Then ;d
End If
End Function
Function drawplayers()
; get a error here about it needing to be a type ?o.0?
DrawImage player1\shipframes,0,0
End Function
Delete player1
As the comment says "DrawImage player1\shipframes,0,0 " gives me an error about needing to be a type?
Const g_ScreenWidth=800, g_ScreenHeight=600 ; Call the BB "Graphics" routine to initialize DirectX
Graphics g_ScreenWidth, g_ScreenHeight,32,1 ; Set up BB to support page-flipping
SetBuffer BackBuffer()
TFormFilter Enable
Global bg_image1
bg_image1=LoadImage("bg.bmp")
Type player
Field shipframes
Field shipframe
Field shipx
Field shipy
Field shipdirection
End Type
player1.player=New player
player1\shipx=50
player1\shipy=50
player1\shipframes=LoadImage("ship1.bmp")
While Not KeyHit(1)
drawbg()
updateplayers()
drawplayers()
Flip
Cls
Wend
Function drawbg()
DrawImage bg_image1,0,0
End Function
Function updateplayers()
If KeyDown(17) Then ;W
End If
If KeyDown(30) Then ;a
End If
If KeyDown(31) Then ;s
End If
If KeyDown(32) Then ;d
End If
End Function
Function drawplayers()
; get a error here about it needing to be a type ?o.0?
DrawImage player1\shipframes,0,0
End Function
Delete player1
As the comment says "DrawImage player1\shipframes,0,0 " gives me an error about needing to be a type?