Okay for some weird reason, when I try to activate one of player two's weapon, which is activated using the 8 button it will not show the sprite that I want it to but if I set it to a command such as end it works perfectly. I have edited my code to make it easier to show what I am focusing on so don't say some variables are not defined.
Game:
do
cls
paste image 1,0,0
set cursor 0,0
sprite 2,p1x,p1y,2
sprite 3,p2x,p2y,17
`Controls for Player 1
if inkey$()="w" then p1y=p1y-1
if inkey$()="s" then p1y=p1y+1
if inkey$()="a" then p1x=p1x-1
if inkey$()="d" then p1x=p1x+1
if inkey$()="1" then weaponSelected1#=1
if inkey$()="2" then weaponSelected1#=2
if inkey$()="3" then weaponSelected1#=3
`_____________________
`Controls for Player 2
if upkey()=1 then p2y=p2y-1
if downkey()=1 then p2y=p2y+1
if leftkey()=1 then p2x=p2x-1
if rightkey()=1 then p2x=p2x+1
if inkey$()="8" then weaponSelected2#=1
if inkey$()="9" then weaponSelected2#=2
if inkey$()="0" then weaponSelected2#=3
`____________________
`Player 1's Halfway Point
if p1x>315
p1x=p1x-1
endif
`_______________________
`Player 2's Halfway Point
if p2x<375
p2x=p2x+1
endif
`_______________________
`Player 1's Corner
if p1x<35
p1x=p1x+1
endif
`________________
`Player 2's Corner
if p2x>665
p2x=p2x-1
endif
`________________
`Center Boundaries
if p1y<200
p1y=p1y+1
endif
if p2y<200
p2y=p2y+1
endif
if p1y>365
p1y=p1y-1
endif
if p2y>365
p2y=p2y-1
endif
`_________________
if weaponSelected1#=1
`Beachball
if p1weapon1$="beachball"
hide mouse
sprite 50,mousex(),mousey(),9
sprite 4,ballx#,bally#,3
sprite 5,p1x,p1y,14
sprite 6,p1x,p1y,15
sprite 7,p1x,p1y,16
hide sprite 4
hide sprite 5
hide sprite 6
hide sprite 7
if mouseclick()=1
newx# = mousex()
newy# = mousey()
targethit = 0 :`flag to minimize checks
hide sprite 2
show sprite 5
wait 200
delete sprite 5
show sprite 6
wait 200
delete sprite 6
show sprite 7
wait 200
delete sprite 7
show sprite 2
endif
if targethit = 0
show sprite 4
ballx# = curvevalue(newx#,ballx#,20)
bally# = curvevalue(newy#,bally#,20)
if abs(ballx#-newx#) < 1
if abs(bally#-newy#) < 1 then targethit=1
endif
endif
if sprite collision(4,3)=1
explosion=rnd(4)
if explosion=0 or explosion=4
p2health#=p2health#-beachballdamage#
delete sprite 4
endif
if explosion=1 or explosion=2
p2health#=p2health#-20
delete sprite 4
wait 200
sprite 9,ballx#,bally#,10
delete sprite 4
wait 300
delete sprite 9
endif
` Reset ball location
ballx# = p1x+50
bally# = p1y
` Reset mouse target
newx# = ballx#
newy# = bally#
` De-select weapon
weaponSelected1#=0
delete sprite 50
show sprite 2
show mouse
endif
if sprite collision(4,50)=1 and targethit=1
delete sprite 4
` Reset ball location
ballx# = p1x+50
bally# = p1y
` Reset mouse target
newx# = ballx#
newy# = bally#
` De-select weapon
weaponSelected1#=0
delete sprite 50
show mouse
endif
endif
endif
`____________________________
if weaponSelected1#=2
`Bucket
if p1weapon2$="bucket"
hide mouse
sprite 50,mousex(),mousey(),9
sprite 5,p1x,p1y,4
sprite 6,p1x,p1y,11
sprite 7,p1x,p1y,12
sprite 8,bucketx#,buckety#,13
hide sprite 5
hide sprite 6
hide sprite 7
hide sprite 8
if mouseclick()=1
newbx# = mousex()
newby# = mousey()
targethit = 0 :`flag to minimize checks
hide sprite 2
show sprite 5
wait 200
delete sprite 5
show sprite 6
wait 200
delete sprite 6
show sprite 7
endif
if targethit = 0
show sprite 8
show sprite 2
bucketx# = curvevalue(newbx#,bucketx#,20)
buckety# = 188 : `curvevalue(newby#,buckety#,20)
if abs(bucketx#-newbx#) < 1 then targethit=1
endif
if sprite collision(8,3)=1
delete sprite 8
p2health#=p2health#-bucketdamage#
` Reset bucket location
bucketx# = p1x+50
buckety# = p1y
` Reset mouse target
newbx# = bucketx#
newby# = buckety#
` De-select weapon
weaponSelected1#=0
delete sprite 50
show mouse
endif
if sprite collision(8,50)=1 and targethit=1
delete sprite 8
` Reset bucket location
bucketx# = p1x+50
buckety# = p1y
` Reset mouse target
newbx# = bucketx#
newby# = buckety#
` De-select weapon
weaponSelected1#=0
delete sprite 50
show mouse
endif
endif
`_________________
endif
if weaponSelected1#=3
if p1weapon3$="watergun"
hide mouse
sprite 50,mousex(),mousey(),9
sprite 4,p1x,p1y,18
sprite 5,watergunx#,waterguny#,8
hide sprite 2
show sprite 4
hide sprite 5
if mouseclick()=1
newwx# = mousex()
newwy# = mousey()
targethit = 0 :`flag to minimize checks
endif
if targethit = 0
show sprite 5
watergunx# = curvevalue(newwx#,watergunx#,20)
waterguny# = 300
if abs(watergunx#-newwx#) < 1 then targethit=1
endif
if sprite collision(5,3)=1
delete sprite 4
show sprite 2
delete sprite 5
p2health#=p2health#-watergundamage#
` Reset watergun location
watergunx# = p1x+50
waterguny# = p1y+35
` Reset mouse target
newwx# = watergunx#
newwy# = waterguny#
` De-select weapon
weaponSelected1#=0
delete sprite 50
show mouse
endif
if sprite collision(5,50)=1 and targethit=1
delete sprite 4
show sprite 2
delete sprite 5
` Reset watergun location
watergunx# = p1x+50
waterguny# = p1y+35
` Reset mouse target
newwx# = watergunx#
newwy# = waterguny#
` De-select weapon
weaponSelected1#=0
delete sprite 50
show mouse
endif
endif
endif
`____________________________
`Begin Player 2
if weaponSelected2#=1
`Handle!
if p2weapon1$="handle"
sprite 4,p2x,p2t,19
mirror sprite 4
hide sprite 4
`19, 20, 21
endif
endif
`___________________
sync
loop
Please explain to why the inkey$() (8) does not work correctly?
Thanks,
Zeus