Hey! Its me again! I got help and fixed the game so it shoots, and added code so that the enemy gets deleted when its made contact with the lazer, but it doesn't work. Help would be appreciated
`Getting Game Ready
SYNC ON
SYNC RATE 30
HIDE MOUSE
`Loading Images.
load image "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Images\YourShip.jpg",1
load image "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Images\AlienShip.jpg",6
load image "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Images\GreenLaser.jpg",4
load image "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Images\RedLaser.jpg",5
load image "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Images\Stars.jpg",50
`Loading Sounds.
load sound "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Sounds\Cannon.wav",1
load sound "C:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Alien Hunter\Sounds\bpulse.wav",2
`Loop Background Music
loop sound 2
`Make Background
MAKE OBJECT PLAIN 4,127,90
POSITION OBJECT 4,0,-4,80
TEXTURE OBJECT 4,50
LOCK OBJECT ON 4
`Color background black
color backdrop rgb(0,0,0)
`Playerfire Score Level and Lives Variables
pf=0:score=0:Level=1:lives=3
`Your Ship X and Y coords
ysx=265:ysy=350
`Places your ship on Screen
sprite 1,ysx,ysy,1
`Enemy Ship X and Y coords
esx=265:esy=90
`Places Enemy ship on Screen
sprite 6,esx,esy,6
`Where lazer shoots from
lx=ysx+23
ly=ysy-60
`Start Main Loop
do
`Print Score Level and Lives on screen
set cursor 10,10: Print "SCORE:";score; " LEVEL:";level;" LIVES:";lives
`Left Key Control
if leftKEY()=1 and ysx>20
dec ysx,10
endif
`Right Key Control
if rightKEY()=1 and ysx<545
inc ysx,10
endif
`Start Shoot Routine
if inkey$()="z"
if pf=0
if zkp=0
zkp = 1
gosub shoot
pf=1
endif
endif
else
zkp = 0
endif
`If Alien Ship Exists, activate blowitup routine.
if SPRITE EXIST(2)=1
if SPRITE HIT(2,3)=1
gosub blowitup
endif
endif
`Refresh Your Ship Position
sprite 1,ysx,ysy,1
`Activate Moveall Routine
gosub moveall
`Activate Movestars Routine
gosub movestars
`Refresh Screen
sync
`End of Loop
loop
`Movestars Routine
movestars:
SCROLL OBJECT TEXTURE 4,0.00,-0.01
return
`Shoot Routine
shoot:
sprite 2,lx,ly,4
PLAY SOUND 1
return
`Moveall Routine
moveall:
if SPRITE EXIST(2)=1
If sprite y(2)>-800
ly=ly-30
sprite 2,lx,ly,4
else
pf=0
lx=ysx+23
ly=ysy-60
endif
else
pf=0
lx=ysx+23
ly=ysy-60
endif
return
`Blow it Up routine
blowitup:
delete sprite 6
for t=6 to 11
sprite 6,500,200,t
wait 1
next t
delete sprite 6
sleep 500
end
sleep 500
return
If you add anything, can you please explain to me what you added so I can learn? Thanks!
-If Practice makes Perfect, and nobody is perfect, why practice?-