# Never fear, SCREEN ZERO HERO's here!

OK, fear a bunch...

---------------------

CLS
tank\$ = CHR\$(127)
LOCATE 24, 40, 1, 7, 7
PRINT tank\$; : LOCATE , POS(1) - 1: tanky% = CSRLIN: tankx% = POS(1)
DO
z1 = TIMER
key\$ = INKEY\$
SELECT CASE key\$
CASE CHR\$(0) + "K"
IF POS(1) > 1 THEN LOCATE , POS(1) - 1: PRINT tank\$ + " "; : LOCATE , POS(1) - 2
tanky% = CSRLIN: tankx% = POS(1)
CASE CHR\$(0) + "M"
IF POS(1) < 79 THEN PRINT " " + tank\$; : LOCATE , POS(1) - 1
tanky% = CSRLIN: tankx% = POS(1)
CASE CHR\$(32): IF bullet% = 0 THEN bullet% = -1: REM Limit one bullet on screen.
CASE CHR\$(27): SYSTEM
END SELECT

REM Fire
SELECT CASE bullet%
CASE -1: bullet% = tanky% - 1: bulletcol% = tankx%
CASE IS > 0
IF bulletdelay% = -1 OR bullet% = tanky% - 1 THEN
z2bullet = TIMER: bulletdelay% = 0
LOCATE bullet%, bulletcol%: PRINT CHR\$(24)
IF CSRLIN <> 24 THEN LOCATE , bulletcol%: PRINT " ";
LOCATE tanky%, tankx%
IF bullet% > 1 THEN
bullet% = bullet% - 1
ELSE
GOSUB erasebullet
bullet% = 0
END IF
END IF
END SELECT

REM Bullet timer delay
IF z2bullet <> 0 THEN
IF z1 < z2bullet THEN z2bullet = z2bullet - 86400
IF z1 - z2bullet >= .06 THEN bulletdelay% = -1
END IF

LOOP
SYSTEM

erasebullet:
LOCATE bullet%, bulletcol%: PRINT " ";
LOCATE tanky%, tankx%
RETURN

--------------------

Check how the z variables are coded. They allow the bullet to travel in a timely fashion while allowing the user to move the tank at the same time.

So move a bit, press the spacebar to fire, and then keep moving your tank while the bullet advances. You can fire again after the bullet reaches the top of the screen.

Pete

Posted on Dec 1, 2009, 8:29 AM

 Response Title Author and Date Thats cool...but UnseenMachine on Dec 1 Code update.. UnseenMachine on Dec 1 It doesn't matter what screen you use... Pete on Dec 1 Nice Pete, but I fear the next hurdle will be multiple shots. Clippy on Dec 1 Hip, hip, array! Pete on Dec 1 What multiple firing ability would look like in SCREEN 0 Pete on Dec 2 *Nice job with the bullet timing! TheBOB on Dec 2 Thanks, but handwriting is on the wall... And it's a Brick one! Pete on Dec 2 * use mouse its smooth and you can move while shooting Ben on Dec 2 Ben, you're a genius! Mouse + alien movement added... Pete on Dec 2 Cool Pete! Clippy on Dec 2 Use INP(96) in a timer tick loop for multiple presses. LINK Clippy on Dec 2 Pete hates INP(96)... Pete on Dec 3 The read loop does cancel the keypress when not used. Clippy on Dec 3 Ah, the num lock is screwing up the results... Pete on Dec 3 The number pad does not send two press codes like the arrow keys do. Clippy on Dec 3 do i have to do it in subs? UnseenMachine on Dec 1 Stupid question! Pete on Dec 1 I cant find the call UnseenMachine on Dec 1 Reasons to use GOSUB... Pete on Dec 1 You don't even know what they are yet. Clippy on Dec 1