Thanks computer, it helped that problem.
But there's still a problem or two. The policeman's still is streched out of size and un-animated.
the image is laid out fine, and these are the sprite no.
1 still
2-8 appear
9-12 attack
13-16 pain
17-23 die
24 fade
Oh and i posted the entire code 'cause i've seen posts where people ask for context, and the prob might be elsewhere. Oh well!
Here's the revised code:
`The Paving Enforcer
sync on
sync rate 30
backdrop on
color backdrop 0
hide mouse
randomize timer()
`vars
mx = mousex() `cursor x
my = mousey() `cursor y
oioammo = 0 `total ammo
smartammo = 0 `smart bombs
oioyes = 0 `firing pause
oiono = 1 `oiono, if set to one will play the still animation elsewhere
plyrhealth = 0 `health
wavenumber = 1 `level number
dim coppain(3) `if pavingcop is in pain
dim copfade(3) `if pavingcop is dying/fading
dim copaction(3) `pavingcop's action 0 =still, 1 =attack, 2 =hurt, 3 =dying, 4 =fade, 5 =spawn
dim cophp(3) `pavingcop's hp
dim copexist(3) `if pavingcop exists
inc oioammo,80
inc smartammo, 2
inc plyrhealth,100
`data
set image colorkey 0,255,255 `blue background
create animated sprite 1, "data\images\ingame\cursor.bmp", 2, 2, 1 `images
load image "data\images\ingame\path1.jpg",2
load image "data\images\ingame\path2.jpg",3
`load image "data\images\ingame\path3.jpg",4
`load image "data\images\ingame\path4.jpg",5
`load image "data\images\ingame\path5.jpg",6
create animated sprite 10, "data\images\ingame\pavcop.bmp", 8, 3, 10
load image "data\images\ingame\1.bmp",61
load image "data\images\ingame\2.bmp",62
load image "data\images\ingame\3.bmp",63
load image "data\images\ingame\4.bmp",64
load image "data\images\ingame\5.bmp",65
load image "data\images\ingame\6.bmp",66
load image "data\images\ingame\7.bmp",67
load image "data\images\ingame\8.bmp",68
load image "data\images\ingame\9.bmp",69
load image "data\images\ingame\0.bmp",60
load image "data\images\ingame\star.bmp",70
load sound "data\sounds\oio11.wav",1 `sounds
load sound "data\sounds\oio12.wav",2
load sound "data\sounds\oio13.wav",3
load sound "data\sounds\oio14.wav",4
load sound "data\sounds\police1.wav",5
load sound "data\sounds\police2.wav",6
load sound "data\sounds\police3.wav",7
load sound "data\sounds\shotgun.wav",8
load sound "data\sounds\apupupupu.wav",9
load sound "data\sounds\music.wav",99 `music
loop sound 99 `play music
`sprite defs
sprite 9,0,0,2
sprite 61,0,0,60
sprite 62,0,0,60
sprite 63,0,0,60 `sprite defs
sprite 64,0,0,60
sprite 65,0,0,60
sprite 66,0,0,60
sprite 67,720,580,70
sprite 10,320,320,10 `temp
sprite 1,0,0,1
set sprite priority 9,0 `sprite layers
set sprite priority 10,2 `this one is temp.
set sprite priority 1,15
`timing
startsec = 0
seconds = startsec
`temp. level
dim leveldata(60,6)
for temp10 = 1 to 60
temp11 = rnd(3)
if rnd(6) = 1 then leveldata(temp10,temp11) = 6 `6 is paving cop
next temp10
temp10 = 0
temp11 = 0
do `main loop
`timing section
inc temp11 `this section does time
if temp11 = 1 then inc seconds
if temp11 = 2 then dec temp11,2
if seconds = 60 then inc wavenumber : seconds = 0
`firing section
if mouseclick()=1
if oioammo > 0
if oioyes = 0
oiono = 0
oiosound = rnd(3) + 1 `random oio sound (1 to 4)
play sound oiosound `if yes = 1 therefore no must = 0
oioyes = 5 `pause until next fire
dec oioammo
endif
endif
endif
if mouseclick()=2
if smartammo > 0
if oioyes = 0
oiono = 0
play sound 9
oioyes = 25 `pause until next fire
dec smartammo
for temp8 = 1 to 3
if copexist(temp8) > 0 then dec cophp(temp8),10
` if grdexist(temp8) > 0 then dec grdhp(temp8),10
next temp8
endif
endif
endif
if oiono = 0 then play sprite 1,2,4,100 `if firing, animate mouse
if oiono = 1 then play sprite 1,1,1,1 `if not, do
dec oioyes `firing pause
if oioyes < 0 then oioyes = 0
if oioyes = 0 then oiono = 1 `if yes = 0 therefore no must = 1
`mouse section
mx=mousex()`mouse position
my=mousey()
if mx>778 then mx=778 `no out of bounds... sorta
if my>578 then my=578
sprite 1,mx,my,1
`enemy control section
`Paving cop
for temp8 = 1 to 3 `three police
if copexist(temp8) > 0
`appear
if copaction(temp8) = 5 and cophp(temp8) = 0
temp9 = rnd(1) + 5 `random alert sound, 5 or 6
play sound temp9
copaction(temp8) = 5 `set spawn action
play sprite copexist(temp8),2,8,100 `teleport animation
cophp(temp8) = int(wavenumber / 5 + 10 + rnd(5)) `sets hp of cop based on wave number
endif
`shooting
if rnd(20) = 1 and copaction(temp8) = 0 `random chance of fire
play sound 8
copaction(temp8) = 1 `set attack action
play sprite copexist(temp8),9,12,100 `if shooting, play animation
endif
`dying or hurt
if sprite collision (1,0) and sprite frame(1) > 1 and cophp(temp8) < 1
victim = sprite collision(1,0)
if victim = copexist(temp8) then dec cophp(temp8),1 : copaction(victim) = 2 : coppain(victim) = 50
if cophp(victim)<1
play sound 7
cophp(victim) = 0 `nullify values
coppain(victim) = 0
copfade(victim) = 0
copaction(victim) = 3
endif
endif
if copaction(temp8) = 0 then play sprite copexist(temp8),1,1,1 `still animation
if copaction(temp8) = 1 then play sprite copexist(temp8),9,12,100 `if shooting, play animation
if copaction(temp8) = 2 then play sprite copexist(temp8),13,16,100 : dec coppain(temp8) `hurt
if copaction(temp8) = 3 then play sprite copexist(temp8),17,23,100 `dying
if copaction(temp8) = 4 then play sprite copexist(temp8),24,24,1 : dec copfade(temp8) `fading
if copaction(temp8) = 5 then play sprite copexist(temp8),2,8,100 `teleport animation
if sprite frame(copexist(temp8)) = 8 then copaction(temp8) = 0 `if done, goto stopped animation
if sprite frame(copexist(temp8)) = 12 then copaction(temp8) = 0 `if done, goto stopped animation
if sprite frame(copexist(temp8)) = 23 then copaction(temp8) = 4 : copfade(temp8) = 255 `if done, goto fade animation
if coppain(temp8) = 0 then copaction(temp8) = 0 `if done, stop animation (really it plays one frame)
if copfade(temp8) = 0 and copaction(temp8) = 4 then copexist(temp8) = 0 `kill sprite
if copfade(temp8) = 0 then dec copfade(temp8) : set sprite alpha copexist(temp8),copfade(temp8) `fade
endif
next temp8
`spawning section
`spawn stuff
for temp10 = 1 to 3
if leveldata(seconds,temp10) = 6 `if paving cop then
if sprite exist(10) = 0 `if slot is empty, create enemy
copexist(temp10) = 10
cophp(temp10) = 0
copaction(temp10) = 5
coppain(temp10) = 0
copfade(temp10) = 0
sprite 10,250+(temp10*20),350,10
endif
endif
next temp10
`status section
`ammo
temp$ = str$(oioammo)
if len(temp$) = 3 then temp3$ = left$(temp$,1) else temp3$ = "0"`third digit
if len(temp$) = 3 then temp2$ = mid$(temp$,2) `second digit when there's 3
if len(temp$) = 2 then temp2$ = left$(temp$,1) `second digit when there's 2
if len(temp$) = 1 then temp2$ = "0" `second digit when there's only 1
temp1$ = right$(temp$,1) `first digit
temp1 = val(temp1$)
temp2 = val(temp2$) `getting sprite numbers right
temp3 = val(temp3$)
inc temp1,60
inc temp2,60 `+60 for sprites
inc temp3,60
sprite 61,780,560,temp1
sprite 62,760,560,temp2 `displays ammo
sprite 63,740,560,temp3
`smarts
if smartammo > 0 then show sprite 67 `smart star
if smartammo = 0 then hide sprite 67
`health
temp7$ = str$(temphealth)
if len(temp7$) = 3 then temp6$ = left$(temp7$,1) else temp6$ = "0"`third digit
if len(temp7$) = 3 then temp5$ = mid$(temp7$,2) `second digit when there's 3
if len(temp7$) = 2 then temp5$ = left$(temp7$,1) `second digit when there's 2
if len(temp7$) = 1 then temp5$ = "0" `second digit when there's only 1
temp4$ = right$(temp7$,1) `first digit
temp4 = val(temp4$)
temp5 = val(temp5$) `getting sprite numbers right
temp6 = val(temp6$)
inc temp4,60
inc temp5,60 `+60 for sprites
inc temp6,60
sprite 64,40,560,temp4
sprite 65,20,560,temp5 `displays health
sprite 66,00,560,temp6
`backdrop changing section
if wavenumber = 20 then sprite 9,0,0,2 `if the backdrop needs changing, change it
if wavenumber = 40 then sprite 9,0,0,3
if wavenumber = 60 then sprite 9,0,0,4
if wavenumber = 80 then sprite 9,0,0,5
sync
loop
end
There's also the problem of the health, but i'm sure i can fix that.
Thanks guys
"Chicken is nice"