Captain Spazer Posted August 23, 2016 Share Posted August 23, 2016 (edited) I'm having some difficulties with getting the horizontal scrolling working. I can get the playfield to "flip" but not scroll, I'm trying to make the playfield scroll horizontal when joy0left and joy0right are used. What am I doing wrong? rem Generated 2016-08-23 17:58:56 by Visual bB Version 1.0.0.566 rem ********************************** rem *<filename> * rem *<description> * rem *<author> * rem *<contact info> * rem *<license> * rem ********************************** set kernel_options pfcolors no_blank_lines set smartbranching on pfhline 8 5 23 on dim rand16 = z player0x=80 : player0y=75 a=10 c=10 player1x=50 : player1y=75 main scorecolor=$44 if a=10 then player0: %01001000 %01111100 %11111110 %01111110 %00000111 %00000110 %00001010 %00010100 end if a=20 then player0: %10000010 %01111100 %11111110 %01111110 %00000111 %00000110 %00001010 %00010100 end COLUP0=$0E if b=0 then REFP0=0 if b=1 then REFP0=8 if c=10 then player1: %00111000 %00011000 %00011000 %00011000 %00011000 %00001000 %00011000 %00011000 end if c=20 then player1: %01100100 %00101100 %00111000 %00011010 %01111110 %01001000 %00011000 %00011000 end c=c+1 if c=30 then c=0 playfield: ................................ ................................ ................................ ................................ ................................ ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X .X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end pfcolors: $f5 $f5 $f5 $43 $f5 $f5 $f5 $26 $24 $22 $D8 $22 end COLUBK=$A8 rem makes the goat headbut people if collision(player0,player1) && b=0 then d=1 if d=1 then e=2 : player1x=player1x+1 : player1y=player1y-1 if collision(player0,player1) && b=1 then d=2 if d=2 then e=2 : player1x=player1x-1 : player1y=player1y-1 rem checks if the human is out of bounds if d=1 && player1y=0 then score=score+10 : d=3 if d=2 && player1y=0 then score=score+10 : d=3 if d=1 && player1x=0 then score=score+10 : d=3 if d=2 && player1x=0 then score=score+10 : d=3 if d=1 && player1y=135 then score=score+10 : d=3 if d=2 && player1y=135 then score=score+10 : d=3 if d=3 then player1x=255 : player1y=255 rem control logistics if joy0left then b=1 : a=a+1 : pfscroll left if joy0right then b=0 : a=a+1 : pfscroll right if joy0right && d=0 then player1x=player1x-1 if joy0left && d=0 then player1x=player1x+1 if d=3 && joy0left then e=e+1 if d=3 && joy0right then e=e+1 if e=60 then d=0 : e=0 if a=30 then a=0 rem scrolling logics if playfieldpos <> 8 then goto __Skip_Draw temp5 = rand : temp6 = rand/2 if temp5 > temp6 then var44 = 0 : var45 = 0 : var46 = 0 : var47 = 0 : goto __Skip_Draw var44 = rand : var45 = rand : var46 = rand : var47 = rand __Skip_Draw drawscreen goto main Source: Billy Goat.bas Edited August 23, 2016 by Captain Spazer Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted August 23, 2016 Share Posted August 23, 2016 The main problem was that you were redrawing the screen in the main loop, so the screen couldn't scroll. I also started adding variable aliases for you so the program will be easier to understand, but I gave up when I got to d since I don't know what it stands for, so you'll need to do the rest: randomterrain.com/atari-2600-memories-batari-basic-commands.html#dim I made some other changes to the code. You're now using a bit to flip the goat instead of wasting an entire variable. There is a scroll counter that limits the speed of the scroll. It's set to 8 right now, but you can change the number to make scrolling faster or slower. billy_goat_2016y_08m_23d_1436t.bas billy_goat_2016y_08m_23d_1436t.bin Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted August 24, 2016 Author Share Posted August 24, 2016 Ahh, I should've known not to redraw in the mainloop. Stupid overlook on my side. Thanks for the assist! Quote Link to comment Share on other sites More sharing options...
Jinroh Posted August 26, 2016 Share Posted August 26, 2016 Slightly off-topic, but since your problem was solved already, cute looking graphics so far. :3 I like the idea of playing as a billy goat. Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted August 26, 2016 Author Share Posted August 26, 2016 Haha, thank you =) Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted September 5, 2016 Author Share Posted September 5, 2016 Another question regarding pfscroll, I have some issues wih having the pfscroll, I get a glitch when I'm trying to do pfscroll down and pfscroll right. I'm using pfheight 8. When the screen ha scrolled down a bit the bottom half gets filled with a huge block of pixels. What gives? set kernel_options pfcolors pfheights dim _Scroll_Control = w pfheights: 8 3 3 3 3 3 3 3 3 3 53 end pfcolors: $00 $44 $46 $48 $1A $1C $1E $C6 $C8 $CA $44 $46 $48 $1A $1C $1E $C6 $C8 $CA $00 end __Start_Restart ;*************************************************************** ; ; Mutes volume of both sound channels. ; AUDV0 = 0 : AUDV1 = 0 ;*************************************************************** ; ; Clears 25 of the normal 26 variables (fastest way). ; a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 10 : g = 0 : h = 0 : i = 0 j = 0 : k = 0 : l = 0 : m = 0 : n = 0 : p = 0 : q = 0 : r = 0 s = 0 : t = 0 : u = 0 : v = 0 : w = 0 : x = 0 : y = 0 ;*************************************************************** ; ; Draws the blocks. ; playfield: ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ end main if collision(missile0,player1) then o=o+1 : missile0x=255 : missile0y=255 : g=1 : q=60 if g=1 then h=h+1 if g=1 && h=60 then score=score+100 : goto __Start_Restart if h>0 then COLUBK=rand else COLUBK=$00 rem makes sound when Master Computer is destroyed if q>1 then AUDV1 = 10 : AUDC1 = 8 : AUDF1 = 16 if q<1 then AUDV1=0 if q>0 then q=q-1 rem Master Computer's shield logic if o=1 && _Scroll_Control = 28 then pfscroll right : pfscroll down : _Scroll_Control = 0 if o=2 && _Scroll_Control = 20 then pfscroll right : _Scroll_Control = 0 if o=3 && _Scroll_Control = 12 then pfscroll right : _Scroll_Control = 0 if o=4 && _Scroll_Control = 4 then pfscroll right : _Scroll_Control = 0 if o>0 then _Scroll_Control = _Scroll_Control + 1 drawscreen goto main Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 5, 2016 Share Posted September 5, 2016 It's because you're using the pfheights I had in another program. To make the pretty little Breakout-style lines, I squished most of the rows down to 3 high and made the last row 53 high to fill in the space. Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted September 5, 2016 Author Share Posted September 5, 2016 Ahh, I see. Hm, I'll see if I can solve it with that information, I don't want too much help on this one yet since I feel I can figure this one out, if I'm wrong I'll shout out again =) 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.