ok that really seems to help, but there seems to be one problem. I believe i did it right, but obviously i didnt, because everytime i try to test launch the game, the window opens, stays black, my mouse disapears, and then it times out.
I dont know if any of you would have a solution for this, but if you do, i would really like to hear it.
here is the code for the program if that helps at all.
;Freeroamer
;Created by Mintybreath
Graphics 800,600,16,2
SetBuffer BackBuffer()
;Constants
Const upkey = 200 ;move the player up
Const downkey = 208 ;move the player down
Const leftkey = 203 ;move the player left
Const rightkey = 205;move the player right
Const humanspeed = 3 ;the speed of the human
Const bulletspeed = 2
;Loaded Images
Global playerimage=LoadImage("player smallest.png")
Global aimimage=LoadImage("reciticle.png")
Global bulletimage=LoadImage("bullet.png")
Global backimage=LoadImage("Full Ground.png")
AutoMidHandle bulletimage
AutoMidHandle playerimage
MaskImage playerimage,0,255,255
AutoMidHandle aimimage
MaskImage aimimage,0,255,255
Type player
Field x,y
End Type
Type bullet
Field x,y
End Type
Type back
Field x,y
End Type
Type aim
Field x,y
End Type
Function initializelevel()
player\y = 250
player\x = 250
End Function
;update the bullets
Function updatebullet()
;for each bullet, move it up 5 pixels
;if it goes off screen delete it
For bullet.bullet = Each bullet
bullet\y = bullet\y - 5
;if bullet moves offscreen, delete it, otherwise draw it onscreen
If bullet\y<0
Delete bullet
Else
DrawImage bulletimage,bullet\x,bullet\y ;draw the image
EndIf
Next
End Function
;Controls
Function Controls()
DrawImage (backimage,back\x,back\y)
DrawImage (playerimage,player\x,player\y)
DrawImage aimimage,aim\x,aim\y
HidePointer
;point and shoot
angle#=ATan2((aim\y - player\y), (aim\x - player\x))
Repeat
bullet\x=bullet\x + Cos(angle#)
bullet\y=bullet\y + Sin(angle#)
Forever
If KeyDown(rightkey)
back\x = back\x - humanspeed
playerimage=LoadImage("player Right.png")
MaskImage playerimage,0,255,255
EndIf
If KeyDown(leftkey)
back\x = back\x + humanspeed
playerimage=LoadImage("player left.png")
MaskImage playerimage,0,255,255
EndIf
If KeyDown(downkey)
back\y = back\y - humanspeed
playerimage=LoadImage("player down.png")
MaskImage playerimage,0,255,255
EndIf
If KeyDown(upkey)
back\y = back\y + humanspeed
playerimage=LoadImage("player smallest.png")
MaskImage playerimage,0,255,255
EndIf
End Function
Global aim.aim = New aim
Global back.back = New back
Global player.player = New player
Global bullet.bullet = New bullet
initializelevel()
;________________________________________________________
;______________________Main Loop_________________________
;________________________________________________________
While Not KeyDown(1)
Cls
aim\y=MouseY()
aim\x=MouseX()
If MouseHit(1) Then
bullet.bullet=New bullet
bullet\x = player\x
bullet\y = player\y
EndIf
;Functions
Controls()
updatebullet()
If KeyHit(30)
EndIf
Flip
Wend
End