Retro Lord Posted June 15, 2015 Share Posted June 15, 2015 It's been ages since I made any games. And I just started again and I realised I've forgot how to dim. The situation is like this: You are a car, driving along, avoiding other cars and running over zombies, when a car or zombie leaves the screen a counter goes up and it gradually turns into night. When it's night you go to a separate screen that gives you 100 bonus points. Now, it is at this point I need the dim that makes the car/zombie that is player1 to move faster. The skeletal structure is: if r=0 then player1y=player1y-1 if r=1 then player1y=player1y-2 if r=2 then player1y=player1y-3 if r=3 then r=0 Any pointers? .bas = default.bas The code should be easely understandable, but if you want me too clearify things just tell me to. rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288 set kernel_option no_blank_lines newstart s=0 player0x = 70 player0y = 70 f=10 main rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME... if f = 10 then player0: %00000000 %00111100 %10111101 %10100101 %11100111 %10100101 %10100101 %00111100 %00111100 %00011000 %00011000 %01011010 %01011010 %01111110 %01011010 %01011010 end COLUP0=$1E if g = 10 then player1: %00000000 %00111100 %10111101 %10100101 %11100111 %10100101 %10100101 %00111100 %00111100 %00011000 %00011000 %01011010 %01011010 %01111110 %01011010 %01011010 end if g = 20 then player1: %00000000 %00100100 %00100100 %00100100 %00100100 %00011000 %00011000 %01011010 %01011010 %01111110 %00000000 %00011000 %00011000 %00011000 %00000000 %00000000 end if g = 30 then player1: %00011000 %00011000 %00011000 %00011000 %01111110 %01111110 %00011000 %00011000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 end if g=10 then COLUP1=$86 if g=20 then COLUP1=$D8 if g=30 then COLUP1=rand COLUPF=$04 playfield: .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXX......... end a=a+1 drawscreen if r=0 then player1y=player1y+1 if r=1 then player1y=player1y+2 if r=2 then player1y=player1y+3 if s=0 then COLUBK=$DE if s=1 then COLUBK=$DC if s=2 then COLUBK=$DA if s=3 then COLUBK=$D8 if s=4 then COLUBK=$D6 if s=5 then COLUBK=$D4 if s=6 then COLUBK=$D2 if s=7 then COLUBK=$D0 if s=8 then COLUBK=$00 if s=9 then goto WIN : r=r+1 if player1y>90 then s=s+1 : score=score+1 : b=(rand&2) : player1y=10 : player1x=rand if player1x<70 then player1x=rand : player1y=0 if player1x>95 then player1x=rand : player1y=0 if g=20 && collision(player0,player1) then score=score+10 : b=(rand&2) : player1y=10 : player1x=rand if g=10 && collision(player0,player1) then goto LOSE if b=0 then g=10 if b=1 then g=10 if b=2 then g=20 if joy0right then player0x = player0x + 1 if joy0left then player0x = player0x - 1 if joy0up then player0y = player0y - 1 if joy0down then player0y = player0y + 1 goto main LOSE COLUPF=$04 COLUBK=rand drawscreen if switchreset then reboot goto LOSE WIN COLUPF=$04 COLUBK=rand q=q+1 drawscreen if q=60 then score=score+100 if q=120 then goto newstart goto WIN Quote Link to comment Share on other sites More sharing options...
graywest Posted June 16, 2015 Share Posted June 16, 2015 Dim allows you to set a descriptive name for a variable. dim Something = a Something = Something + 1 a = a + 1 The last two lines do the same thing if you use the "dim" statement to assign the name "Something" to variable a. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted June 16, 2015 Share Posted June 16, 2015 Dim allows you to set a descriptive name for a variable. dim Something = a Something = Something + 1 a = a + 1 The last two lines do the same thing if you use the "dim" statement to assign the name "Something" to variable a. I think he might be talking about this: randomterrain.com/atari-2600-memories-batari-basic-commands.html#fixedpoint Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted June 16, 2015 Author Share Posted June 16, 2015 Thank you all for the help, got things the way I want now, you'r awesome =) Quote Link to comment Share on other sites More sharing options...
freshbrood Posted February 24, 2016 Share Posted February 24, 2016 Hi everyone. I was unclear on how to use dim. So, if I'm clear; it's only real purpose is to let us keep track of variables easier- instead of remember what "a" or "e" was keeping track of.. Is that right? And, if so.. wouldn't excessive use of dim commands actually INCREASE code size slightly? I mean "a" obviously uses less characters/bytes than "something". Yes? Quote Link to comment Share on other sites More sharing options...
RevEng Posted February 24, 2016 Share Posted February 24, 2016 The variable names don't contribute to the ROM usage. There's only one effect of using more descriptive variable names - your source code becomes easier to read. 1 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted February 25, 2016 Share Posted February 25, 2016 The variable names don't contribute to the ROM usage. There's only one effect of using more descriptive variable names - your source code becomes easier to read. Added that to the bB page: randomterrain.com/atari-2600-memories-batari-basic-commands.html#dim_descriptive_names 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.