Jump to content
IGNORED

Switching playfield with pfscroll not working


Retro Lord

Recommended Posts

I can't get the hang of switching out playfields when I'm using pfscroll. Any idea why this is not working?

When e is less then 20 the first playfield is used, and when e is greater or equal to 20 I want the second playfield to be shown but it never does. What am I doing Wrong?

 rem Generated 2015-03-08 17:10:41 by Visual bB Version 1.0.0.554
 rem **********************************
 rem *<filename>                      *
 rem *<description>                   *
 rem *<author>                        *
 rem *<contact info>                  *
 rem *<license>                       *
 rem **********************************

   set kernel_options player1colors



   dim rand16 = z

   pfhline 8 5 23 on

        set smartbranching on

 player1x=20 : player1y=50

   dim _Scroll_Control = g.h


 if e<20 then playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X...............................
 X...............................
 X...............................
 ...............X................
 ...............X................
 ...............X................
 ........................X.......
 ........................X.......
 ........................X.......
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

 if e>=20 then playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 ..............XX............XX..
 ..............XX............XX..
 .......XX.......................
 .......XX............XX.........
 ..............XX.....XX.....XX..
 ..............XX............XX..
 .......XX.......................
 .......XX............XX.........
 .....................XX.........
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end




main

 COLUBK=$AA

  f=f+1
  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
  if f = 10 then player1:
        %00000100
        %00011000
        %00111010
        %00111100
        %00111000
        %00001100
        %00000110
        %00101101
        %01101001
        %11000110
        %00000010
        %00000010
        %00000100
        %00000000
        %00000000
        %00000000
end
   if f = 10 then player1color:
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $02;
    $02;
    $0E;
    $0E;
    $0E;
end
  if f = 20 then player1:
        %00000100
        %00011000
        %00111010
        %00111100
        %00111000
        %00001100
        %00000110
        %00101101
        %11101001
        %00000110
        %00000010
        %00000010
        %00000100
        %00000000
        %00000000
        %00000000
end
   if f = 20 then player1color:
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $1E;
    $02;
    $02;
    $02;
    $0E;
    $0E;
    $0E;
end

  if f=20 then f=0

 c=c+1

 COLUPF=$44

 scorecolor=$0E

    if a=0 then _Scroll_Control = _Scroll_Control + 0.50
   if _Scroll_Control > 1 then pfscroll left : _Scroll_Control = 0

 if joy0fire then b=1 else b=0

  if b=0 then player1y=player1y+1
 if b=1 then player1y=player1y-1

 if collision(player1,playfield) then gosub DEATH


 drawscreen

 if c=60 then score=score+1 : e=e+1 : c=0

 goto main


DEATH

 scorecolor=rand

 d=d+1

 drawscreen

 if d=120 then d=120

 if joy0fire && d>=120 then reboot

 goto DEATH
Link to comment
Share on other sites

If you're expecting the second screen to appear when the game reboots and e is equal to or greater than 20, it won't work because all of the variables are cleared since you are using reboot:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#reboot

 

Using reboot also screws up random numbers, so you might want to stop using it.

 

 

You can get some ideas about restarting a game from Tinkernut World Deluxe:

 

atariage.com/forums/topic/235427-tinkernut-world-deluxe-example-program/

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...