Jump to content



0

Colors


8 replies to this topic

#1 esplonky OFFLINE  

esplonky

    Moonsweeper

  • 292 posts
  • Kinetic, Not synthetic.
  • Location:Canyon Lake, TX

Posted Fri May 13, 2011 9:57 AM

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!

#2 SeaGtGruff OFFLINE  

SeaGtGruff

    River Patroller

  • 4,545 posts
  • Location:Georgia, USA

Posted Fri May 13, 2011 12:27 PM

View Postesplonky, on Fri May 13, 2011 9:57 AM, said:

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

#3 atari2600land OFFLINE  

atari2600land

    Quadrunner

  • 6,495 posts
  • All hail the zyzzyva!
  • Location:Salem, Oregon

Posted Fri May 13, 2011 12:35 PM

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, Fri May 13, 2011 12:35 PM.


#4 theloon OFFLINE  

theloon

    Stargunner

  • 1,015 posts

Posted Tue May 17, 2011 8:46 AM

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, Tue May 17, 2011 9:07 AM.


#5 esplonky OFFLINE  

esplonky

    Moonsweeper

  • 292 posts
  • Kinetic, Not synthetic.
  • Location:Canyon Lake, TX

Posted Thu May 19, 2011 2:12 PM

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


#6 esplonky OFFLINE  

esplonky

    Moonsweeper

  • 292 posts
  • Kinetic, Not synthetic.
  • Location:Canyon Lake, TX

Posted Thu May 19, 2011 2:13 PM

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

#7 SeaGtGruff OFFLINE  

SeaGtGruff

    River Patroller

  • 4,545 posts
  • Location:Georgia, USA

Posted Thu May 19, 2011 2:50 PM

View Postesplonky, on Thu May 19, 2011 2:13 PM, said:

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

#8 esplonky OFFLINE  

esplonky

    Moonsweeper

  • 292 posts
  • Kinetic, Not synthetic.
  • Location:Canyon Lake, TX

Posted Mon May 23, 2011 2:25 PM

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

#9 esplonky OFFLINE  

esplonky

    Moonsweeper

  • 292 posts
  • Kinetic, Not synthetic.
  • Location:Canyon Lake, TX

Posted Mon May 23, 2011 2:27 PM

nevermind, i figured it out!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users