hey just about finished my game now, thanx for all the help, got a few problems though,
1. the crosshair when should go over celebrity goes under
2. when generating another celebrity to appear there is a flicker where another random celeb appears and disappears.
can someone plz take a look at my code and check to see where i could improve. thnx for the help so far and any help given from now on
Mico
rem Hollywood Shootout V0.2.1
rem David McClymont\Alan Horne
sync on : sync rate 60 : hide mouse
set text font "arial" : set text size 16
set text to bold : set text transparent
load bitmap "graphics\Hollywoodsign bullets.jpg"
suspend for key
rem Load wall and images
load bitmap "graphics\Background2.bmp",1
load image "graphics\bullet hole.jpg",1
load image "graphics\crosshair.bmp",2
load image "graphics\fire.bmp",3
rem Load sound
load sound "Sounds fx\gun.wav",1
for t=2 to 10
clone sound t,1
next t
rem Setup crosshair sprite
set current bitmap 0
set sprite 1,0,1
offset sprite 1,16,16
draw to front
rem Setup bullet sprite
sprite 2,-100,-100,1
set sprite 2,0,1
offset sprite 2,8,8
size sprite 2,16,16
rem Particle effect setup
autocam off : backdrop off
rem Set start pos
posx#=320
posy#=240
score=0
dim celeb$(15)
celeb$(0)="graphics\50 cent2.jpg"
celeb$(1)="graphics\Adam Sandler2.bmp"
celeb$(2)="graphics\Arnold.jpg"
celeb$(3)="graphics\Blaine.jpg"
celeb$(4)="graphics\george bush2.bmp"
celeb$(5)="graphics\homer2.jpg"
celeb$(6)="graphics\Jim Carrey.jpg"
celeb$(7)="graphics\j-lo.jpg"
celeb$(8)="graphics\Michael Jackson.jpg"
celeb$(9)="graphics\Mike Myers.bmp"
celeb$(10)="graphics\Ozzy.jpg"
celeb$(11)="graphics\britney.jpg"
celeb$(12)="graphics\christina.jpg"
celeb$(13)="graphics\Sylvester Stallone.jpg"
celeb$(14)="graphics\BruceWillis.jpg"
remstart a=rnd(14)
load bitmap celeb$(a), 11
get image 11,0,0,52,85
delete bitmap 11
remend
rem Main loop
do
rem Read mouse
posx#=posx#+mousemovex()
posy#=posy#+mousemovey()
posx=posx# : posy=posy#
fire=mouseclick()
rem Position crosshair
`sprite 1,posx,posy,2
rem Make bullet hole if triggered
if fire=1 and cool=0
rem Make bullet hole
set current bitmap 1
paste sprite 2,posx+rx,posy+ry
paste sprite 2,1000,1000
set current bitmap 0
rem Generate some particles
rem emis=2
rem Hear machine gun
cool=10
for t=1 to 10
if sound playing(t)=0 then play sound t : t=11
next t
rem Gun recoil
if ForcePresent=1 then force shoot 100,100
endif
if cool>0 then dec cool
rem Control emissions
rem set particle emissions 1, emis
if emis>0 then dec emis
rem Show Framerate
ink rgb(255,0,0),0 : text 20,screen height()-40,desc$
`text screen width()-20-text width(fps$),screen height()-40,fps$
randomize timer()
dim winx(5)
winx(0)=112
winx(1)=217
winx(2)=312
winx(3)=411
winx(4)=502
dim winy(3)
winy(0)=18
winy(1)=143
winy(2)=265
remstart a=rnd(14)
load bitmap celeb$(a), 11
get image 11,0,0,52,85
delete bitmap 11
remend
rem sprite 11, 150, 150, 11
remstart
load bitmap "Graphics\50 cent2.jpg", 11
get image 11, 0, 0, 52, 85
delete bitmap 11
remend
cls
`score=score+1
rem do
q=RND(4)
s=RND(1)
w=RND(4)
x=RND(2)
`cls
if sprite exist(20)
size sprite 20, 52, 85
sprite 1,posx,posy,2
if sprite collision(20,1) and mouseclick() = 1
delete sprite 20
rem inc score
score=score+1
endif
else
a=rnd(14)
load bitmap celeb$(a), 20
get image 20,0,0,52,85
delete bitmap 20
if q=2 and s=2
sprite 20, winx(w), winy(x), 20
else
sprite 20, winx(q), winy(s), 20
endif
endif
`sprite 1,posx,posy,2
`sprite 1,mousex(),mousey(),2
copy bitmap 1,0
print "Score :";score
sync
loop