Posted: 15th Nov 2004 06:51
hey heres some better code for anybody who wants to help me with it. I'll post the new images soon.
[/code]
sync on
sync rate 60
`hide mouse
hide mouse
`define variables
x= 320
y= 240
x1= 358
xshot= x1+10
bulletlife= 0
`load images
load image "megamanstill.bmp", 1
load image "megamanshootingwoball.bmp", 2
load image "megamanshot.bmp", 3
load image "megamanrun1.bmp", 4
load image "megamanrun2.bmp", 5
load image "megamanrun3.bmp", 6
load image "megamanrun4.bmp", 7
load image "megamanrunshoot1.bmp", 8
load image "megamanrunshoot2.bmp", 9
load image "megamanrunshoot3.bmp", 10
`the main loop
do
`ensure sprite doesn't go off screen
if x>600 then x=600
if x<0 then x=0
`move left
if leftkey()= 1
dec x,5
dec x1,5
else
sprite 1,x,y,1
endif
`move right
if rightkey()= 1
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(1)= 1 then hide sprite 1
if sprite exist(4)= 1 then show sprite 4
sprite 4,x,y,4
wait 150
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
repeat
if x>600
x= 600
endif
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then show sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 5,x,y,5
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then show sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 6,x,y,6
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if returnkey()= 1 and bulletlife<= 0
goto runshoot
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then show sprite 7
sprite 7,x,y,7
inc x,15
inc x1,15
wait 150
until rightkey()= 0
else
if sprite exist(1)= 1 then hide sprite 1
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 1,x,y,1
endif
`shoot
if returnkey()= 1
goto shoot
endif
if rightkey()= 1 and returnkey()= 1
goto runshoot
endif
`the shooting part
shoot:
if returnkey()= 1 and bulletlife<= 0
hide sprite 1
if sprite exist(2)= 1 then show sprite 2
sprite 2,x,y,2
xshot=x1+10
wait 200
bulletlife=60
else
if sprite exist(2)= 1 then hide sprite 2
if sprite exist(1)=1 then show sprite 1
sprite 1,x,y,1
endif
`draw bullet
if bulletlife<=0
if sprite exist(3)=1 then hide sprite 3
else
if sprite exist(3)=1 then show sprite 3
sprite 3,xshot,250,3
inc xshot,5
dec bulletlife
endif
runshoot:
if rightkey()= 1 and returnkey()= 1 and bulletlife<=0
if sprite exist(1)= 1 then hide sprite 1
if sprite exist(4)= 1 then show sprite 4
if sprite exist(5)= 1 then hide sprite 5
if sprite exist(6)= 1 then hide sprite 6
if sprite exist(7)= 1 then hide sprite 7
sprite 4,x,y,4
wait 150
repeat
if x>600
x= 600
endif
xshot=x1+10
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then show sprite 8
if sprite exist(9)= 1 then hide sprite 9
if sprite exist(10)= 1 then hide sprite 10
sprite 8,x,y,8
wait 200
bulletlife=60
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then hide sprite 8
if sprite exist(9)= 1 then show sprite 9
if sprite exist(10)= 1 then hide sprite 10
sprite 9,x,y,9
inc x,15
inc x1,15
wait 150
if x>600
x= 600
endif
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then hide sprite 8
if sprite exist(9)= 1 then hide sprite 9
if sprite exist(10)= 1 then show sprite 10
sprite 10,x,y,10
inc x,15
inc x1,15
wait 150
until rightkey()= 0
else
if sprite exist(1)= 1 then show sprite 1
if sprite exist(4)= 1 then hide sprite 4
if sprite exist(8)= 1 then hide sprite 8
if sprite exist(9)= 1 then hide sprite 9
if sprite exist(10)= 1 then hide sprite 10
sprite 1,x,y,1
endif
`draw bullet
if bulletlife<=0
if sprite exist(3)=1 then hide sprite 3
else
if sprite exist(3)=1 then show sprite 3
sprite 3,xshot,250,3
inc xshot,5
dec bulletlife
endif
`end loop
sync
loop
[code]