Hey again! I tried but couldn't figure out how to add score and another enemy after one is dead.
I added a Score = +50 at end of my blowup routine but it only adds once, and I can't really test out unless I have more enemys. So heres the code:
`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,6)=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
Score = +50
delete sprite 6
sprite 6,esx,esy,6
end
return
So if you can, tell me how I would make it to add another enemy to game at same place when the first enemy is dead. Thanks!
-If Practice makes Perfect, and nobody is perfect, why practice?-