Hey everyone,
I'm fooling around with DBC, and I decided to try something out. I have a circle at the bottom of the screen, that can only go up to a certain extent. I got that with working after a little while, with no problems. Now I want the circle to shoot a bar when the spacebar is pressed. I got that to happen, but it only worked once per execution. So, I added the attack=0 or 1 part to take care of that. I wanted it to be able to shoot faster, so I tried using an array. Now I can't figure out what I'm doing wrong. I know that I'm probably missing something very basic, so if someone could help me out, it would be greatly appreciated.
SYNC RATE 60
SYNC ON
x=30
y=400
DIM x(30)
DIM y(30)
n=1
DO
CLS
x=MoveX(x)
y=MoveY(y)
CIRCLE x,y,5
IF SCANCODE()=57 AND attack=0
attack=1
x(n)=AttackX(x)
y(n)=AttackY(y)
ENDIF
IF attack=1 THEN GOSUB Attack
SYNC
LOOP
FUNCTION MoveX(x)
IF RIGHTKEY()=1 AND x<639
x=x+1
ENDIF
IF LEFTKEY()=1 AND x>10
x=x-1
ENDIF
ENDFUNCTION x
FUNCTION MoveY(y)
IF UPKEY()=1 AND y>300 THEN y=y-1
IF DOWNKEY()=1 AND y<470 THEN y=y+1
ENDFUNCTION y
FUNCTION AttackX(x)
x2=x
ENDFUNCTION x2
FUNCTION AttackY(y)
y2=y
ENDFUNCTION y2
ATTACK:
FOR n=1 to n
y(n)=y(n)-2
INC count
TEXT x(n),y(n),"|"
IF count=50
y(n)=y
attack=0
INC n
ENDIF
NEXT n
RETURN
Calliah