Author Topic: Button bash bullets  (Read 4144 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 319
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Button bash bullets
« on: April 27, 2012 »
And ship. 
Old bit of code I didn't apply.
Didn't stick with it to simplify it.  Couldn't now any way.
I was just happy I could write the code.

L/R and X to fire.
Code: [Select]
open window 640,512
xb=320
yb=505
xm=320
ym=505
b=1
bullet=6
dim fire(bullet),xb(bullet),yb(bullet),bm(bullet)
for a=1 to bullet
fire(a)=0
yb(a)=500
xb(a)=xm
bm(a)=0
next a
ship=21
dim l(ship),s(ship),h(ship),i(ship),p(ship)
for a=1 to ship
read l(a),s(a),h(a),i(a),p(a)
next a
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
setrgb 1,50,50,50
fill rectangle 0,0 to 640,512
c=peek("port1")
if and(c,128)>0 xm=xm-8
if and(c,32)>0 xm=xm+8
if xm<11 xm=11
if xm>629 xm=629
if and(c,16384)>0 and go=0 then
z=z+3
if z>5 z=5
if z=5 go=1
endif
if z>4 b=b+1
if b>bullet b=1
for a=1 to bullet
if z>4 and b=a fire(a)=1
if fire(a)=1 then
bm(a)=bm(a)+0.5
yb(a)=yb(a)-bm(a)
endif
if yb(a)<-20 then
yb(a)=500
xb(a)=xm
fire(a)=0
bm(a)=0
endif
if yb(a)=500 xb(a)=xm
setrgb 1,200,200,0
fill rectangle xb(a)-8,yb(a)-10 to xb(a)-6,yb(a)
fill rectangle xb(a)+6,yb(a)-10 to xb(a)+8,yb(a)
if bm(a)>1 and bm(a)<7 then
setrgb 1,200,100,0
fill triangle xb(a)-9,yb(a)+2 to xb(a)-5,yb(a)+2 to xb(a)-7,yb(a)+12
fill triangle xb(a)+5,yb(a)+2 to xb(a)+9,yb(a)+2 to xb(a)+7,yb(a)+12
endif
next a
if and(c,16384)>0 and go=1 then
z=z-3
if z<0 z=0
endif
if and(c,16384)=0 go=0
for a=1 to ship
setrgb 1,l(a),l(a),l(a)
line xm+s(a),ym+h(a) to xm+i(a),ym-p(a)
next a
text 600,260,str$(b)
until (1=0)

data 200,-10,0,-10,3
data 200,-9,0,-9,4
data 200,-8,0,-8,5
data 200,-7,0,-7,6
data 200,-6,0,-6,7
data 200,-5,0,-5,8
data 40,-4,0,-4,16
data 80,-3,0,-3,17
data 120,-2,0,-2,18
data 150,-1,0,-1,19
data 150,0,0,0,20
data 150,1,0,1,19
data 120,2,0,2,18
data 80,3,0,3,17
data 40,4,0,4,16
data 200,5,0,5,8
data 200,6,0,6,7
data 200,7,0,7,6
data 200,8,0,8,5
data 200,9,0,9,4
data 200,10,0,10,3
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Button bash bullets
« Reply #1 on: April 29, 2012 »
You could make a nice retro shoot em up out of this.

Challenge Trophies Won:

Offline Wenlock

  • C= 64
  • **
  • Posts: 68
  • Karma: 4
  • BASIC & Testcards rule.
    • View Profile
Re: Button bash bullets
« Reply #2 on: May 22, 2012 »
Cool, have to type it in.
YABASIC ROOLZ!

Offline Galileo

  • ZX 81
  • *
  • Posts: 22
  • Karma: 0
    • View Profile
Re: Button bash bullets
« Reply #3 on: September 04, 2014 »
Nice!