Jump to content
IGNORED

Change pfcolor at certain event?


Rabbit 2600

Recommended Posts

Playfield pixels.

 

You could use data, but you'll probably want to use if-thens to keep it simple for now. You'd have your counter increase by one (variable = variable + 1) and if your counter equals the number you want, you'd use COLUPF = (whatever color you want). You'd just have a handful of if-thens, similar to how you do it for an animation with if-then.

Link to comment
Share on other sites

Here's an example using a data array. In this example a frame counter (a) is incremented every frame, then after 60 frames (1 second) the color counter (t) is incremented. If the color counter reaches 16 it gets reset, because the data array in this example has only 16 values in it.

 

  t = 0 : a = 0 : rem in this example a is a frame counter
  playfield:
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
end
loop
  COLUPF = playfieldcolor[t]
  drawscreen
  a = a + 1
  if a = 60 then a = 0 : t = t + 1
  if t = 16 then t = 0
  goto loop
  data playfieldcolor
  $08,$18,$28,$38,$48,$58,$68,$78,$88,$98,$A8,$B8,$C8,$D8,$E8,$F8
end

playfieldcolor.bas

playfieldcolor.bas.bin

Link to comment
Share on other sites

If the color values you're using have a specific pattern like those above, you could do something like:

 

counter = counter + 1

temp1 = counter & 15

COLUPF = 4 + temp1

 

This would flip through all colors of the second-darkest color value (82, 98, etc.).

 

Another example, which mimics what SeagtGruff's code does, would be:

 

  t = 0 : a = 0 : rem in this example a is a frame counter
  playfield:
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
  XXXX....XXXX....XXXX....XXXX....
  ....XXXX....XXXX....XXXX....XXXX
end
loop
  COLUPF = t + $08
  drawscreen
  a = a + 1
  if a = 60 then a = 0 : t = t + $10
  goto loop

Edited by Cybearg
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...