set kernel_options no_blank_lines rem ***************************************************** rem * rem * Name: Double-click Draw rem * Version: 2008y-03m-22d-1100 rem * rem ***************************************************** rem * rem * Programmer: Fort Apocalypse (adapted by Random Terrain) rem * Language: batari Basic v1.00 rem * System: Atari 2600 VCS rem * rem ***************************************************** rem * rem * Use joystick controller to move cursor. Press fire button to rem * draw or erase. Press select switch or stop moving and rem * double-click fire button to change color of playfield pixels. rem * rem ***************************************************** rem * Create aliases for variables. dim click=a dim color=b dim count=c dim ctrack=d dim cursor=e dim delay=f dim pointerx = g dim pointery = h dim still=i dim timer=j dim volume=k dim makenoise=l dim freq=m dim soundcheck=n playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ end rem * Initialize title screen variables. pointery=234 : still=1 rem * Set y position of Sprite 0 and set background color, scorecolor, and PF color. player0y=pointery : COLUBK=194 : scorecolor=194 : COLUPF=196 goto double rem ***************************************************** rem * rem * Title screen loop rem * rem ***************************************************** titlescreenloop rem * Set sprite 0 color and increase size of sprite 0. COLUP0=color : NUSIZ0=$07 rem * Extra playfield scroll. delay=delay+1 : if delay>3 then delay=0: pfscroll up drawscreen pfscroll up rem * Scroll words and switch to next word in list when the time comes. player0y=player0y-1 : if player0y<2 then player0y=pointery : still=still+1 : on still goto nothing double click draw rem * If joystick is not pressed, continue loop. if !joy0fire then goto titlescreenloop rem ***************************************************** rem * rem * Game setup. rem * rem ***************************************************** gamestart rem * Initialize variables. click=0 : color=30 : count=5 : ctrack=0 cursor=2 : delay=0 : pointerx=0 : pointery=0 still=1 : timer=0 : makenoise=0 rem * Set position and height of missile 1. missile1x=18 : missile1y=8 : missile1height=8 rem * Set background color and score color. COLUBK = 0 : scorecolor=0 rem * Get rid of sprite 0. player0x=0 : player0y=0 : COLUP0=0 rem * Clear and reset playfield. pfclear : playfieldpos=8 rem ***************************************************** rem * rem * Game loop starts here rem * rem ***************************************************** mainloop rem * Set playfield color. COLUPF=color rem * Set missile width and color. NUSIZ1=$20 : COLUP1=cursor rem * Timer for double-click timer=timer+1 : if timer>10 then timer=10 : click=0 rem * Fire button pressed and released once if joy0fire && click=0 then click = 1 : timer=0 if !joy0fire && click=1 then click=0 : if timer<7 then click = 2 : timer=0 rem * Fire button pressed and released twice for complete double-click if joy0fire && click=2 then click = 3 : timer=0 if !joy0fire && click=3 then click=0 : if timer<7 then timer=0 : goto colorchange rem * Make sound. if delay<3 then if makenoise=1 then volume=volume-1 : AUDV0=volume : AUDC0=12 : AUDF0=freq : if volume=0 then volume=16 : makenoise=0 drawscreen rem * Delay delay=delay+1 if delay14 then cursor=14 : ctrack = 1 if ctrack=1 then cursor=cursor-2 : if cursor<2 then cursor=2 : ctrack = 0 rem * Player movement. if joy0left then click=0 : pointerx = pointerx - 1 : missile1x = missile1x - 4 : still=0 : if pointerx=255 then pointerx = 0 : missile1x = 18 : still=1 if joy0right then click=0 : pointerx = pointerx + 1 : missile1x = missile1x + 4 : still=0 : if pointerx=32 then pointerx = 31 : missile1x = 142 : still=1 if joy0up then click=0 : pointery = pointery - 1 : missile1y = missile1y - 8: still=0 : if pointery=255 then pointery = 0 : missile1y = 8 : still=1 if joy0down then click=0 : pointery = pointery + 1 : missile1y = missile1y + 8: still=0 : if pointery=11 then pointery = 10 : missile1y = 88 : still=1 rem * Draw or erase. if joy0fire && still=0 then pfpixel pointerx pointery flip : still=1 rem * Reset program if reset switch is pressed. if switchreset then reboot rem * Change playfield color if select switch is pressed. if switchselect then goto colorchange goto mainloop rem ***************************************************** rem * Change the playfield color and set up sound. colorchange color=color+2 : if color=0 then color=2 makenoise=1 : volume=14 soundselect delay=rand if delay>169 then freq=16 if delay<170 then freq=15 if delay<86 then freq=14 if soundcheck=freq then goto soundselect soundcheck=freq : delay=0 goto mainloop rem * Crap for title screen. nothing goto titlescreenloop double player0: %11111000 %11111000 %11111000 %11111000 %10000000 %10000000 %10000000 %10000000 %11110000 %11110000 %11110000 %11110000 %10000000 %10000000 %10000000 %10000000 %11111000 %11111000 %11111000 %11111000 %00000000 %00000000 %00000000 %00000000 %11111000 %11111000 %11111000 %11111000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %00000000 %00000000 %00000000 %00000000 %11110000 %11110000 %11110000 %11110000 %10001000 %10001000 %10001000 %10001000 %11110000 %11110000 %11110000 %11110000 %10001000 %10001000 %10001000 %10001000 %11110000 %11110000 %11110000 %11110000 %00000000 %00000000 %00000000 %00000000 %01110000 %01110000 %01110000 %01110000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %00000000 %00000000 %00000000 %00000000 %01110000 %01110000 %01110000 %01110000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %01110000 %01110000 %01110000 %01110000 %00000000 %00000000 %00000000 %00000000 %11110000 %11110000 %11110000 %11110000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %11110000 %11110000 %11110000 %11110000 end rem * Select random sprite color. rem * If color is not different from last time, try again. tcolor ctrack=rand if ctrack<255 then color=254 if ctrack<254 then color=238 if ctrack<238 then color=222 if ctrack<222 then color=206 if ctrack<206 then color=190 if ctrack<190 then color=174 if ctrack<174 then color=78 if ctrack<78 then color=62 if ctrack<62 then color=46 if ctrack<46 then color=30 if ctrack<30 then color=14 if j =color then goto tcolor j=color rem * Select random position of sprite. rem * If position is not different from last time, try again. position pointerx=rand if pointerx>110 then pointerx=110 if pointerx<30 then pointerx=30 if pointerx>64 && click>64 then goto position if pointerx<65 && click<65 then goto position click=pointerx player0x=pointerx pointery=204 goto titlescreenloop click player0: %10001000 %10001000 %10001000 %10010000 %10010000 %10010000 %10100000 %10100000 %10100000 %11000000 %11000000 %10100000 %10100000 %10100000 %10010000 %10010000 %10010000 %10001000 %10001000 %10001000 %00000000 %00000000 %00000000 %00000000 %01111000 %01111000 %01111000 %01111000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %01111000 %01111000 %01111000 %01111000 %00000000 %00000000 %00000000 %00000000 %11111000 %11111000 %11111000 %11111000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %00100000 %11111000 %11111000 %11111000 %11111000 %00000000 %00000000 %00000000 %00000000 %11111000 %11111000 %11111000 %11111000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %00000000 %00000000 %00000000 %00000000 %01111000 %01111000 %01111000 %01111000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %10000000 %01111000 %01111000 %01111000 %01111000 end pointery=184 goto titlescreenloop draw player0: %01010000 %01010000 %01110000 %01110000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %00000000 %00000000 %00000000 %00000000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %11111000 %11111000 %11111000 %11111000 %10001000 %10001000 %10001000 %10001000 %01110000 %01110000 %01110000 %01110000 %00000000 %00000000 %00000000 %00000000 %10001000 %10001000 %10001000 %10001000 %10010000 %10010000 %10010000 %10010000 %11110000 %11110000 %11110000 %11110000 %10001000 %10001000 %10001000 %10001000 %11110000 %11110000 %11110000 %11110000 %00000000 %00000000 %00000000 %00000000 %11110000 %11110000 %11110000 %11110000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %10001000 %11110000 %11110000 %11110000 %11110000 end still=0 pointery=234 goto titlescreenloop