Jump to content
IGNORED

How to do coloured Sprites?


Steril707

Recommended Posts

I am using Skipdraw for my sprites, and everything seems to work fine, and i guess i understood now how skipdraw works in terms of the pointer subtraction it does inside a page.

 

Now i want one of my sprites to have a new color each line...

 

I tried to do the same thing that Skipdraw does with a colortable + appropriate pointer, and wanted to use a simple

lda (colortable), y

sta COLUP0

inside my kernal,

, but didnt get far with this.

 

So, can somebody tell me something about this, or point me to some threads with info about how to get coloured sprites working? I havent found anything here using the Atariage-search yet...

 

thanks a lot,

Michael

Link to comment
Share on other sites

I am using Skipdraw for my sprites, and everything seems to work fine, and i guess i understood now how skipdraw works in terms of the pointer subtraction it does inside a page.

 

Now i want one of my sprites to have a new color each line...

 

I tried to do the same thing that Skipdraw does with a colortable + appropriate pointer, and wanted to use a simple

lda (colortable), y

sta COLUP0

inside my kernal,

, but didnt get far with this.

 

So, can somebody tell me something about this, or point me to some threads with info about how to get coloured sprites working? I havent found anything here using the Atariage-search yet...

 

thanks a lot,

Michael

These may be dumb questions, but did you define the lo-byte/hi-byte pointers for colortable, did you set them to the correct lo-byte/hi-byte values, and did you create a table of color values at the address pointed to by those pointers?

 

Michael

Link to comment
Share on other sites

Hey Michael,

i am currently in the weird situation that i cannot post any code, for the pc where i code at is not connected to the internet. This will change over the next days though...

 

I think i did all the things you mentioned, but i am not completely sure if i did everything the right way... Hmm, i guess i have to wait until i can post some code, once more ;)

 

anyway, thanks... :)

 

Michael

Link to comment
Share on other sites

Hi there,

I think i did all the things you mentioned, but i am not completely sure if i did everything the right way... Hmm, i guess i have to wait until i can post some code, once more ;)
Have a look my Climber 5 source. Unfortunately I can't find it right now. You should be able to find it if you do a search in the forums or [stella]. I did the same thing you're trying to do with the climber.

 

Make sure you set up your indirect pointer for your colors the same way you set up your indirect pointer to the graphics data.

 

This is how I set mine up...

   sec
  lda #KERNEL_HEIGHT
  tay							 ; used for the kernel
  sbc verPosP1					; subtract the climber vertical position
  adc #CLIMBER_HEIGHT-1		   ; add back in the climber height to get the
							   ; offset
  sta climberOffset			   ; this is decremented in the kernel to
							   ; determine when the y-register is in range
							   ; to draw the climber
  clc
  adc playerGraphicLSB			; add the value to the graphic pointer LSB
  sta playerPointer			   ; so the indirect read doesn't cross a page
							   ; boundary
  lda climberOffset
  clc
  adc playerColorsLSB			 ; now calculate the color pointer LSB the
  sta playerColorPointer		  ; same way

 

Then in the kernel I would do the typical...

   lda #CLIMBER_HEIGHT-1		   ; 2
  dcp climberOffset			   ; 5
  bcs .colorClimber			   ; 2
  SLEEP_9						 ; 9
  lda #0						  ; 2
  beq .drawClimber				; -10
  
.colorClimber
  lda (playerColorPointer),y	  ; 5
  sta COLUP1					  ; 3
  lda (playerPointer),y		   ; 5
.drawClimber
  sta GRP1						; 3

 

Also, your colors would have the same page restrictions as your graphic data.

 

I hope this helps.

Link to comment
Share on other sites

Can't i just change the Player color all the time...I guess it doesnt make any difference, if i do a playercolor-write and the player isnt being drawn this scanline anyway, isnt it?

If by "change the Player color all the time" you mean on each scan line-- or pair of scan lines, if you're using a 2-line kernel-- then I don't think that would work unless you're also drawing the player on each line (i.e., a 192-line or 96-line tall player). Otherwise, the index to the playercolor table won't match up with the index to the playershape table, see? Also, it would take up more ROM.

 

On the other hand, if ROM isn't an issue, but cycles *are* an issue, then playershape and playercolor tables that span the height of the screen might be useful, since you could just load and store the playershape and playercolor data on each line, without having to spend cycles on testing any variables and then taking the appropriate branches. But since your player will presumably need to move in the vertical direction, you'll need to pad the beginning and end of the tables with enough "blank" lines to let you move the player vertically by changing the point at which you start reading from the tables.

 

Michael

Link to comment
Share on other sites

Hi there,

Just one question: Can't i just change the Player color all the time...I guess it doesnt make any difference, if i do a playercolor-write and the player isnt being drawn this scanline anyway, isnt it?
You could but if you're using skipDraw and indirect indexing for the colors then your cycle counts wouldn't be constant it you did a read outside the table.
Link to comment
Share on other sites

@ Dennis: Hmm, somehow i don't get this whole thing together..I concentrated on other things though on my game.

I still hope i can tackle this subject not too far in the future..

 

@Michael: I am using a 2lk, but i still have y being in the "true" scanline count, not the halfed one. just doing dey after every STA WSYNC. Else i couldn't update the background and foreground colors each row on Bombjack.

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...