Jump to content
Sign in to follow this  
esplonky

Colors

Recommended Posts

i use COLUP0 and COLUP1 and it just makes them black figures.no matter what color i choose they are always black. i use player0color and player1color and have all the 6502 tia codes and that just makes my missile look like player 0 is taking a shit. please help!

Share this post


Link to post
Share on other sites

i use COLUP0 and COLUP1 and it just makes them black figures.no matter what color i choose they are always black. i use player0color and player1color and have all the 6502 tia codes and that just makes my missile look like player 0 is taking a shit. please help!

The bB kernel automatically changes COLUP0 and COLUP1 to the scorecolor when it draws the score at the bottom of each frame.

 

Therefore you need to set COLUP0 and COLUP1 inside your loop so they get (re)set for each new frame.

 

If you haven't set the scorecolor, it will be black.

 

  rem * this example will have black players

  COLUBK = $06 : rem * gray
  COLUP0 = $44 : rem * red
  COLUP1 = $84 : rem * blue

  player0:
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
end

  player1:
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
end

  player0x = 30
  player0y = 32

  player1x = 120
  player1y = 64

loop

  drawscreen
  goto loop

 

  rem * this example will have green players

  COLUBK = $06 : rem * gray
  COLUP0 = $44 : rem * red
  COLUP1 = $84 : rem * blue
  scorecolor = $C4 : rem * green

  player0:
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
end

  player1:
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
end

  player0x = 30
  player0y = 32

  player1x = 120
  player1y = 64

loop

  drawscreen
  goto loop

 

  rem * this example will have a red and a blue player

  COLUBK = $06 : rem * gray
  scorecolor = $C4 : rem * green

  player0:
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
end

  player1:
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
  %11111111
end

  player0x = 30
  player0y = 32

  player1x = 120
  player1y = 64

loop

  COLUP0 = $44 : rem * red
  COLUP1 = $84 : rem * blue
  drawscreen
  goto loop

Michael

Share this post


Link to post
Share on other sites

if you're using player0color and player1color, you should be able to do the following and have it work:

 

player0color:
 66 
 66
 66
 66
end

 

te number of colors you put in player0color is how many pixels high your character is.

Edited by atari2600land

Share this post


Link to post
Share on other sites

SeaGtGruff already gave the proper answer but I'd like to add it's a good idea to create your own draw event section to take care of this kind of stuff.

 

In my Nitebear on Sleepystreet game I've got the housekeeping in my own draw event section as such:

 

draw_event
rem If scrolling variable is set to true and the first bit of the counter is 1 then scroll the screen down
if scrolling && counter{0} then pfscroll down
rem If the march counter is toggled then flip the sprites around to look like they're animated
if march then REFP0 = 8 : REFP1 = 8
rem Since I change Nitebears color depending on his hit points I've got that wrapped up in a separate subroutine
gosub paint_nitebear
rem BatariBASIC forgets the sprite colors every drawsceen so set them to the current enemy size and color variables 
COLUP1 = enemycolor
NUSIZ1 = enemysize
rem Now that everything is set draw that screen![/color]
drawscreen

paint_nitebear
rem Depending on how low the hit points are set the player color via constants to make color codes more understandable
if nitebearhp > 50 then COLUP0 = c_tan : return
if nitebearhp > 25 then COLUP0 = c_orange : return
if nitebearhp > 10 then COLUP0 = c_red
return

Edited by theloon

Share this post


Link to post
Share on other sites

here is my code, can someone just tell me what to put in it to add color to it?

 

 

lives=128
dim lives_centered = 1
dim lives_compact = 1 
 
set romsize 4k
titlescreen

COLUBK = 28
COLUPF = 36



playfield:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X.....XXXXXXX..............XX..X
X..X...XXXXXXXXXXX...XXXXXXXX..X
X..XX...XXXXXXXXXX...XXXXXXXX..X
X..XXX...XXXXXXXXX...XXXXXXXX..X
X..XXXX...XXXXXXXX...XXXXXXXX..X
X..XXX...XXXXXXXXX...XXXXXXXX..X
X..XX...XXXXX..XX....XXXXXXXXXXX
X..X...XXXXXX.......XXXXXXXXX..X
X.....XXXXXXXX.....XXXXXXXXXX..X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end



PF0 = %10101010


drawscreen
if joy0fire then goto start
goto titlescreen

start

playfield:
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
end

COLUBK = 60
COLUPF = $3E
player0x=99:player0y=90
player1x=20:player1y=20
missile0height=8:missile0y=255
NUSIZ0 =  82
scorecolor = 

sprites

player0:
%00000000
%01000100
%01000100
%01000100
%01000100
%00111000
%00111000
%00111000
%00111000
%00111000
%00111000
%00111000
%00111000
%11111110
%10111010
%10111010
%10111010
%00111000
%00000000
%00000000
end

player1:
%00000000
%00100100
%00011000
%00111100
%00011000
%00011000
%00111100
%00000000
end


if missile0y>240 then goto skip
missile0y = missile0y-2:goto draw_loop
skip
if joy0fire then missile0y =  player0y-2:missile0x =player0x+4
if switchreset then reboot


draw_loop
drawscreen

if player1y < player0y then player1y = player1y+1
if player1y > player0y then player1y = player1y-1
if player1x < player0x then player1x = player1x+1
if player1x > player0x then player1x = player1x-1
player1x = player1x:player1y = player1y

if joy0up then player0y = player0y-1: goto jump
if joy0down then player0y = player0y+1: goto jump
if joy0left then player0x = player0x-1: goto jump
if joy0right then player0x = player0x+1: goto jump

if collision(missile0,player1) then score=score+1:player1x=rand/2:player1y=0:missile0y=255
if collision(player0,player1) then lives=lives-32:player1x=rand/2:player1y=0:missile0y=255
if collision(player1,ball) then score=score+0:player1x=rand/2:player1y=0:bally=255
if lives < 32 then reboot

jump
goto sprites

Share this post


Link to post
Share on other sites

oops, i also forgot to delete the line "if collision(player1,ball) then score=score+0:player1x=rand/2:player1y=0:bally=255" so don't mind that, i was experimenting, and figured out how to drop an item when you fire

Share this post


Link to post
Share on other sites

oops, i also forgot to delete the line "if collision(player1,ball) then score=score+0:player1x=rand/2:player1y=0:bally=255" so don't mind that, i was experimenting, and figured out how to drop an item when you fire

One problem is the "scorecolor" statement, which has nothing after the "=" sign.

 

You need to add a "COLUP0" and a "COLUP1" statement to set the player colors. You could put them anywhere between the "sprites" label and the "drawscreen" statement, since the "sprites" label is the beginning of the main screen display loop.

 

Note that if you aren't going to be updating the player graphics, you can move the "player0:" and "player1:" statements out of the loop, above the "sprites" label, because the pointers to the player graphics will retain their values until you set them to something else, so you don't need to keep redefining the player graphics every time you go through the loop.

 

Likewise, you can move the "playfield:" statement above the "titlescreen" label, because you don't need to keep redefining the playfield each time through the loop.

 

Another issue I just noticed is the "drawscreen" statement in the "titlescreen" routine needs to be indented.

 

Michael

Share this post


Link to post
Share on other sites

and one more question, how do i get the playfield in the titlescreen loop to display what it shows? it just gives me a black screen instead of the big "DJ!" in there

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...