All your help has been great, guys. The gameplay for my first project is nearly done. A weird bug arose, however. Whenever I click the mouse, all the sprites slow down to the starting speed, when they should be incrementally faster.
Gosub Setup
do
` gosub Menu
gosub OnClick
gosub CityHit
gosub RefScreen
` gosub EndGame
sync
loop
end
Rem *********************
Rem Procedures
Rem *********************
remstart
Menu:
remend
OnClick:
for P = 1 to (8*SN)
if SPRITE EXIST(P)
if mouseclick()=1
s=sprite collision(1002,P)
if s <> 0 then INC F#,.05: INC E,1 : delete SPRITE p `: play sound 2
endif
endif
next P
if mouseclick()=1 then Sprite 999,mousex(),mousey(),999 : offset sprite 999,55,55 : set sprite alpha 999,128 : show sprite 999 `: play sound 3
if mouseclick()=0 then Sprite 999,mousex(),mousey(),999 : offset sprite 999,55,55 : set sprite alpha 999,128 : hide sprite 999
return
CityHit:
for P = 1 to (8*SN)
if sprite exist(P)
k=sprite collision(2011,P)
if k = 1 then delete sprite P : INC D,1 `: play sound 4
endif
next P
return
RefScreen:
` the sprite display. include the movement and display subroutines
paste image 1000,0,0
`Sprite 999,mousex(),mousey(),999 : offset sprite 999,55,55 : set sprite alpha 999,128
sprite 1002,mousex(),mousey(),1002 : hide sprite 1002
text 0,0,str$(E)
text 0,10,str$(D)
For P = 1 to (8*SN)
if sprite exist(P) then move Sprite P,-.5*(F#)
Next P
return
remstart
EndGame:
if E = 150 then cls : paste image 5002,0,0
if D = 25 then cls : paste image 5001,0,0
remend
Setup:
rem set up display of background, city, score, top score
Set display mode 1024,768,32
Sync On
Randomize Timer()
hide mouse
` F is the increment of speed on kill
` E is the shot tally
` D is the city hit tally
SW = screen width()
SH = screen height()
F# = 1
SN = 40
E = 0
D = 0
Q = 24
REM **********
REM Create Sprites
REM **********
`load sound "sounds\ambient.wav",1
`load sound "sounds\virus_impact.wav",2
`load sound "sounds\keyboard_beep.wav",3
`load sound "sounds\shield_impact.wav",4
`load image "menu\base.jpg",5000,1
`load image "menu\bad.jpg",5001,1
`load image "menu\good.jpg",5002,1
load image "tex\cosmos.jpg",1000,1
load image "tex\crosshair.tga",999,1
load image "tex\phishing.tga",1,1
load image "tex\postcard.tga",2,1
load image "tex\degrees.tga",3,1
load image "tex\mytob.tga",4,1
load image "tex\ghost.tga",5,1
load image "tex\mydoom.tga",6,1
load image "tex\ultimate.tga",7,1
load image "tex\spy.tga",8,1
load image "city\b1_64x118.tga",2001,1
load image "city\b2_64x130.tga",2002,1
load image "city\b3_78x205.tga",2003,1
load image "city\b4_43x235.tga",2004,1
load image "city\b5_139x249.tga",2005,1
load image "city\b6_97x137.tga",2006,1
load image "city\b7_47x275.tga",2007,1
load image "city\b8_169x169.tga",2008,1
load image "city\b9_71x226.tga",2009,1
load image "city\b10_44x198.tga",2010,1
load image "tex\mountains.tga",2011,1
get image 1002,0,0,1,1,1
REM sprite placements
REM Change ystarts to modify timing of descents
REM City display
sprite 2011,0,SH-108,2011
sprite 2001,Q+12,SH-116,2001
sprite 2002,Q+85,SH-128,2002
sprite 2003,Q+148,SH-203,2003
sprite 2004,Q+232,SH-232,2004
sprite 2005,Q+280,SH-236,2005
sprite 2006,Q+467,SH-137,2006
sprite 2007,Q+582,SH-275,2007
sprite 2008,Q+647,SH-152,2008
sprite 2009,Q+824,SH-223,2009
sprite 2010,Q+913,SH-194,2010
`loop sound 1
Dim xstart(SN)
For P = 1 to SN
xstart(P)=(SW/10)*(rnd(8)+1)
Next P
dim ystartPH(SN)
For P = 1 to SN
ystartPH(P)=-rnd(360)-189*P
Next P
dim ystartPO(SN)
For P = 1 to SN
ystartPO(P)=-rnd(405)-657*P
Next P
dim ystartDE(SN)
For P = 1 to SN
ystartDE(P)=-rnd(389)-1223*P
Next P
dim ystartTB(SN)
For P = 1 to SN
ystartTB(P)=-rnd(487)-1673*P
Next P
dim ystartGH(SN)
For P = 1 to SN
ystartGH(P)=-rnd(579)-1361*P
Next P
dim ystartMY(SN)
For P = 1 to SN
ystartMY(P)=-rnd(709)-1879*P
Next P
dim ystartUL(SN)
For P = 1 to SN
ystartUL(P)=-rnd(749)-1925*P
Next P
dim ystartSP(SN)
For P = 1 to SN
ystartSP(P)=-rnd(411)-14082*P
Next P
For P = 1 to SN
Sprite P,xstart(P),ystartPH(P),1 : offset sprite P,90,90
Next P
For P = 1 to SN
Sprite P+SN,xstart(P),ystartPO(P),2 : offset sprite P+SN,90,90
Next P
For P = 1 to SN
Sprite P+(SN*2),xstart(P),ystartDE(P),3 : offset sprite P+SN*2,90,90
Next P
For P = 1 to SN
Sprite P+(SN*3),xstart(P),ystartTB(P),4 : offset sprite P+SN*3,90,90
Next P
For P = 1 to SN
Sprite P+(SN*4),xstart(P),ystartGH(P),5 : offset sprite P+SN*4,90,90 : set sprite alpha P+SN*4,128
Next P
For P = 1 to SN
Sprite P+(SN*5),xstart(P),ystartMY(P),6 : offset sprite P+SN*5,90,90 : set sprite alpha P+SN*5,128
Next P
For P = 1 to SN
Sprite P+(SN*6),xstart(P),ystartUL(P),7 : offset sprite P+SN*6,90,90
Next P
For P = 1 to SN
Sprite P+(SN*7),xstart(P),ystartSP(P),8 : offset sprite P+SN*7,90,90
Next P
return
I want to do something so that when the mouse is held down, it doesn't keep executing my mouseclick()=1, so the player actually has to click on each one. I actually am making this game like a Wii game. I'm controlling it with a laser pointer that works like a mouse, and each mouseclick fires the laser, just like pulling a trigger. The crosshair is to help calibrate this, and to show the player where they are hitting on the screen.
Images attached this time, along with the code so you don't have to copy and paste. Sorry for forgetting so many times.
[edit] I just implemented sprite exist(), so much better than shrinking, hiding, and rotating my sprites. Thanks!