05-12-2006, 11:01 PM
A pointless shooting app! :wtnod:
Arrows change turret angle, space fires.
You might have to adjust the delay value at the top if it runs too fast or slow.
Arrows change turret angle, space fires.
You might have to adjust the delay value at the top if it runs too fast or slow.
Code:
'Angle Shot
'By Zachary Vernon
'Last updated (mm/dd/yy): 05/12/06
#define delay 6000000
#define radConv 0.01745329
#include "fbgfx.bi"
type particle
x as double
y as double
xinc as double
yinc as double
l as integer
end type
angle=90
dim as double sinT(0 to 360),cosT(0 to 360)
dim as double radians,tx1,tx2,ty1,ty2
redim b(2) as particle
for i=0 to 360
radians=radConv*i
sinT(i)=sin(radians)
cosT(i)=cos(radians)
next
screenres 320,200
circle (160,200),10,15,,,,f
tx2=160+(cosT(angle)*15)
ty2=200-(sinT(angle)*15)
line (160,200)-(tx2,ty2)
locate 25,1:print "90 degrees";
b(0).l=0
do until multikey(1)
for i=0 to ubound(b)
if b(i).l=1 then
pset (b(i).x,b(i).y),0
b(i).x+=b(i).xinc
b(i).y+=b(i).yinc
pset (b(i).x,b(i).y)
for n=1 to delay/liveB:next
if b(i).x<-1 or b(i).y<-1 or b(i).x>320 then
b(i).l=0
liveB+=-1
end if
end if
next
if multikey(SC_LEFT) and angle<160 then angleInc=5
if multikey(SC_RIGHT) and angle>20 then angleInc=-5
if angleInc then
line (160,200)-(tx2,ty2),0
angle+=angleInc
tx2=160+(cosT(angle)*15)
ty2=200-(sinT(angle)*15)
line (160,200)-(tx2,ty2)
circle (160,200),10,15,,,,f
angleInc=0
locate 25,1
print " ";
locate 25,1
print ltrim$(str$(angle));" degrees";
end if
if multikey(SC_SPACE) then
pi=ubound(b)
redim preserve b(pi+1)
b(pi).l=1
b(pi).xinc=cosT(angle)*5
b(pi).yinc=-sinT(angle)*5
b(pi).x=160+(cosT(angle)*16)
b(pi).y=200-(sinT(angle)*16)
liveB+=1
end if
if liveB=0 then
for i=1 to delay:next
end if
if liveB=0 then redim preserve b(1)
locate 1,1:print" ";:locate 1,1:print ubound(b);
loop
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
--------------------------------------
Freebasic is like QB, except it doesn't suck.