shoot your little bullets by Anonymous Coder19th Jan 2004 9:06
|
---|
Summary move the little sprite with your mouse. click. Description a program designed as an experiment with the mouse and sprite manipulation. You can shoot bullets, move your "ship" and invert the mouse. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `shootbullet version 0.9-first "release" `James Pendo `Alias "Jonir" `in this program you can move around a little ship with the mouse. `the mouse can be inverted in any axis. That was the origional intent `of this program. `now you can also shoot a bullet and reload with l and r mouse buttons, `respectively. `~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `NOTE: you must have a bitmap titled "bitmap.bmp" in your folder. `NOTE: it should be 32x32. `no sound or enemies... yet. `no lives or health... yet. `no annoying voices at the beginning... ever. rem screen is 640x480 verystart: `variable store hide mouse bullets=10 dim bulletxpos(10) : dim bulletypos(10) bullet=0 dim time#(10) for count=1 to 10 time#(count)=-1 next count onscreen=1 ` program `select inversion begin: print "input selection" print "1:direct" print "2:invert" print "3:invx" print "4:invy" input "?",selection select selection case 1 : xinv=0 : x=1 : yinv=0 : y=1 : endcase case 2 : xinv=1 : x=-1 : yinv=1 : y=-1 : endcase case 3 : xinv=1 : x=-1 : yinv=0 : y=1 : endcase case 4 : xinv=0 : x=1 : yinv=1 : y=-1 : endcase case default : print "try again, idiot!" : goto begin : endcase endselect `directions cls print "Move mouse to manipulate your ship. Left-click to shoot." print "Right click to reload." print "Press any key to continue. (Note: I am not Bill Gates.)" suspend for key cls `loading sprites `bullet dot 1,1:dot 1,2:dot 2,1:dot 2,2 get image 2,1,1,3,3 `ship~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ load bitmap "bitmap.bmp",1 get image 1,0,0,32,32 delete bitmap 1 set cursor 1,465 : print bullets `loop do xpos=mousex() ypos=mousey() xposition=(xpos*x)+(640*xinv) yposition=(ypos*y)+(480*yinv) sprite 1,xposition,yposition,1 `show bullets for count=onscreen to bullet if (bulletypos(11-count)+1)+time#(count)<=-2 onscreen = onscreen+1 : cls : set cursor 1,465 : print bullets : endif sprite count+1,bulletxpos(11-count),(bulletypos(11-count)+1)+time#(count),2 time#(count)=time#(count)-.002 next count `shoot if mouseclick()=1 : suspend for mouse if bullets>0 bullets=bullets-1 cls : set cursor 1,465 : print bullets bulletxpos(bullets+1)=xposition+15 : bulletypos(bullets+1)=yposition+1 bullet=bullet+1 else set cursor 1,440 : print "RELOAD!" endif endif `reload if mouseclick()=2 : bullets=10 : bullet=0 : onscreen=1 for count=1 to 10 : time#(count)=-1 : next count cls set cursor 1,465 : print bullets : endif if inkey$()="q" then goto verystart loop |