;*************************************************************** ; ; Special thanks below for the smaple codes on Batari Basic ; hints, tips, code snippets, and more from AtariAge members ; such as batari, SeaGtGruff, RevEng, Robert M, Nukey Shay, ; Atarius Maximus, jrok, supercat, GroovyBee, and bogax. ; code snippets from Atarius Maximus's "GTA style game" ; code snippets from Quad Runner's "move_around_rooms" ; code snippets from Stargunner's "Space dungeon" ; code snippets from Mountain King "GizzlewapG16" ; code snippets from Gemintronic 4 Way Scroller ; sprite codes from PAC-MAN-RED ; sprites codes from GoB! Fight for the Desert Patrick Jahn, Greg Kinsey, John Swisshelm ; code below complied together by Lewis2907 to make Multsprite Demo ; ;*************************************************************** ; ; msk_pf_rd demo ; code provided by Bogax ; ; code from Gemintronic "SLost001.zip" ; ;``````````````````````````````````````````````````````````````` ;*************************************************************** ; ; If this program will not compile for you, get the latest ; version of batari Basic: ; ; http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#gettingstarted ; ;``````````````````````````````````````````````````````````````` ;*************************************************************** ; ; Batari Basic Programing Page / Tips ; Page maintained by Randon Terrain (RT) ; ; http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html ; ;``````````````````````````````````````````````````````````````` ;*************************************************************** ; ; Atari Age Batari Basic Forum ; This forum is excellent to post and search for answers to programming problems ; ; http://atariage.com/forums/forum/65-batari-basic/ ; ;``````````````````````````````````````````````````````````````` ;*************************************************************** ; ; Kernel setup. ; neeed to work on bank switch for more space ; include fixed_point_math.asm includesfile multisprite_bankswitch.inc set kernel multisprite set romsize 32k set tv ntsc set optimization speed set smartbranching on set optimization noinlinedata set optimization inlinerand ;*************************************************************** ; ; Variable aliases go here (DIMs) ; ; You can have more than one alias for each variable. ; If you use different aliases for bit operations, ; it's easier to understand and remember what they do. ; ; I start variable aliases with one underscore so I won't ; have to worry that I might be using bB keywords by mistake. ; I also start labels with two underscores for the same ; reason. The second underscore also makes labels stand out ; so I can tell at a glance that they are labels and not ; variables. ; ; When every variable has an alias and all aliases are near the beginning ; of your program in an alphabetical list, you (and anyone else that might ; have to read your code) will be able to easily see the variables you are ; using and which variables are free to use. Please do not sprinkle DIMs ; throughout your code. Keep them all together in an alphabetical list near ; the beginning of your program. ; ; Use bit operations any time you need a simple off/on ; variable. One variable essentially becomes 8 smaller ; variables when you use bit operations. ; ; I start my bit aliases with "_Bit" then follow that ; with the bit number from 0 to 7, then another underscore ; and the name. Example: _Bit0_Reset_Restrainer ; ;``````````````````````````````````````````````````````````````` ;``````````````````````````````````````````````````````````````` ; Player1-4 fixed point variables for more flexibility in ; gameplay mechanics. ; dim _P0_L_R = player0x.a dim _P0_U_D = player0y.b ;``````````````````````````````````````````````````````````````` ; Reflects player sprites (flips them horizontally) ; dim _Bit6_Flip_P0 = c dim _Bit7_Flip_P1 = c ;``````````````````````````````````````````````````````````````` ; Using variables instead of temp1 and temp 2 ; Use variable for players 1-5 ; dim global_temp1 = d dim global_temp2 = e ;``````````````````````````````````````````````````````````````` ; "screenheight" ; At this time, the only supported values are 80 and 84, and 80 only works ; for row heights < 8 while 84 only works for row heights < 4. Other values ; for screenheight may be allowed in the future. If you try to use other values ; now, strange things may happen. ; ; "pfheight" ; pfheight is a special variable that specifies the height of ; playfield blocks, minus one. Acceptable values are 31, 15, 7, 3, 1, and 0. ; However pfheight 0 doesn't work properly when sprites are on the screen, ; so it's probably only useful for static displays like title screens. ; const screenheight=80 pfheight=1 ;*************************************************************** ; ; Clears all normal variables and old playfield variables ; (fastest way). ; a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 0 : h = 0 : i = 0 j = 0 : k = 0 : l = 0 : m = 0 : n = 0 : o = 0 : p = 0 : q = 0 : r = 0 s = 0 : t = 0 : u = 0 : v = 0 : w = 0 : x = 0 : y = 0 : z = 0 ;*************************************************************** ; ; Displays the screen to avoid going over 262. ; drawscreen ;*************************************************************** ; ; Sets starting position of player0. ; Score set up ; playfield setup ; player0x = 76 player0y = 48 scorecolor = $22 playfield: ..XXXXXXXXXXXXX. ..XXXXXXXXXXXXX. ..X........X.... ..X........X.... ..X........X.... ..X........X.... ..X..XXXX..X..XX ..X............. ..X............. ..X............. ..X............. ..X..XXXXXXX..XX ..X..X.....X.... ..X..X.....X.... ..X..X.....X.... ..X..X.....X.... ........X.....X. ........X.....X. ........X.....X. ........X.....X. ..X..XXXXXXX..X. ..X............. ..X............. ..X............. ..X............. ..XXXX..XXXXXXX. ..X........X.... ..X........X.... ..X........X.... ..X........X.... ..X..X..X..X..XX ..X..X..X..X..X. ..X..X..X..X..X. ..X..X..X..X..XX ..X.....X....... ..X.....X....... ..X.....X....... ..X.....X....... ..XXXXXXXXXXXXX. ..XXXXXXXXXXXXX. end player0: %01000100 %00100100 %00011000 %01011010 %00110100 %01110100 %00011110 %00000000 end goto __Main_Loop __Main_Loop ;*************************************************************** ; ; Sets colors. ; COLUP0 = $1C : COLUBK= 0 : COLUPF = $86 global_temp1 = (player0x - 16)/4 global_temp2 = (player0y-3)/2 ;*************************************************************** ; ; if sprite crosses the playfield the score changes ; if pfread(global_temp1, global_temp2) then score = 0 else score = 1 ;*************************************************************** ; ; Dsiable diagonal controls ; if joy0up && joy0left then goto __Skip_Movement if joy0up && joy0right then goto __Skip_Movement if joy0down && joy0left then goto __Skip_Movement if joy0down && joy0right then goto __Skip_Movement ;*************************************************************** ; ; Don't move up if pfpixel is in the way. (Works somewhat, 1 pixel off) ; Don't move up off screen. Boundry set. ; if joy0up then global_temp2=global_temp2+1 if joy0up && !pfread(global_temp1, global_temp2) then _P0_U_D= _P0_U_D - 1 if joy0up then _P0_U_D = _P0_U_D + 1 if player0y > 84 then _P0_U_D = _P0_U_D - 1 ;*************************************************************** ; ; Don't move down if pfpixel is in the way. (Works for 8*8 sprite) ; Don't move up off screen. Boundry set. ; if joy0down then global_temp2=global_temp2-4 if joy0down && !pfread(global_temp1, global_temp2) then _P0_U_D= _P0_U_D + 1 if joy0down then _P0_U_D = _P0_U_D - 1 if player0y < 4 then _P0_U_D = _P0_U_D + 1 ;*************************************************************** ; ; Don't move right if pfpixel is in the way. (Works for 8*8 sprite) ; Don't move right off screen. Boundry set. ; if joy0right then global_temp1=global_temp1+2 if joy0right && !pfread(global_temp1, global_temp2) then _P0_L_R = _P0_L_R - 1 if joy0right then _P0_L_R = _P0_L_R + 1 : _Bit6_Flip_P0{6} = 0 : _Bit7_Flip_P1{7} = 0 if player0x > 132 then _P0_L_R = _P0_L_R - 1 ;*************************************************************** ; ; Don't move Left if pfpixel is in the way. (Works somewhat, 1 pixel off) ; Don't move left off screen. Boundry set. ; if joy0left then global_temp1=global_temp1 - 1 if joy0left && !pfread(global_temp1, global_temp2) then _P0_L_R = _P0_L_R + 1 if joy0left then _P0_L_R = _P0_L_R - 1 : _Bit6_Flip_P0{6} = 1 : _Bit7_Flip_P1{7} = 1 if player0x < 20 then _P0_L_R = _P0_L_R + 1 __Skip_Movement ;**************************************************************** ; ; Flips player0 sprite when necessary. ; if _Bit6_Flip_P0{6} then REFP0 = 8 ;**************************************************************** ; ; Flips player1 sprite when necessary. ; if _Bit7_Flip_P1{7} then REFP1 = 8 drawscreen goto __Main_Loop bank 2 bank 3 bank 4 bank 5 bank 6 bank 7 bank 8 inline pfread_msk.asm