Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > clipping sprites
2010-06-01 11:06
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
clipping sprites

Hi

I am coding a game with a screen of 24 columns horizontaly, and one of the sprites might leave that window and I need to to clip it, I thought of using a black sprite to cover the other one, but unfortunately can't waste a sprite for that. Also I thought of creating new frames for the sprite to simulate that but that would inflate the number of frames a lot. Is there another way?

Thanx
 
... 5 posts hidden. Click here to view all posts....
 
2010-06-01 13:55
Iapetus/Algarbi/Wood

Registered: Dec 2004
Posts: 71
Quote: How many colors do you need in your char gfx?

There's another way if you use multicolor mode. If you set your sprites behind char gfx in multicolor mode, the sprite ONLY goes behind %11 and %10 colors, but stays in front of %00 and %01 colors.

So if you make your border from %11 or %10 colors and the graphics using only %00 or %01 colors, then you're set. It *does* greatly limit the colors in your gfx area though (basically it leaves you with singlecolor gfx in 2x1 resolution..). Btw, that also works with bitmap graphics.

You can also make your sprite the same color as the borders, then you will not see it ;) (this limits your sprite color, or forces you to pick another border color..)


Thx WVL

That is too much restrictive, I will use the AND method to clip sprite. :)
2010-06-01 14:01
WVL

Registered: Mar 2002
Posts: 886
Darnit.. I typed a whole lotta extra text and then was refused to edit my previous post ;)

What I wanted to say is that in the interference part in Pearls for Pigs I used the 2nd option : make the sprites-to-be-clipped the same color as the border.. Which is the reason for the lousy purple-colored border :D

I could have made the border any color, but I couldnt since I'm storing sprite images in those border areas. (so there were all color combos in the bitmap data).

May I ask if you use multicolor or singlecolor chars? and how many colors?

Ooh! and this is a nice excuse for the SAX command :D
ldx #andvalue_for_left_column
lda fromsprite+0
sax tosprite+0
lda fromsprite+3
sax tosprite+3
lda fromsprite+6
sax tosprite+6
...

ldx #andvalue_for_middle_column
lda fromsprite+1
sax tosprite+1
lda fromsprite+4
sax tosprite+4
lda fromsprite+7
sax tosprite+7
...

ldx #andvalue_for_right_column
lda fromsprite+2
sax tosprite+2
lda fromsprite+5
sax tosprite+5
lda fromsprite+8
sax tosprite+8
...

which is about 510 cycles ~ 9 rasterlines. Unrolling and SAX will save you +- 5 rasterlines.. maybe that's worthwhile to you! You can save even more if you're OK with storing the clipped sprite in the 0page, in which case you can get down to 447 cycles, about 8 rasterlines..
2010-06-01 17:10
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quoting WVL
which is about 510 cycles ~ 9 rasterlines. Unrolling and SAX will save you +- 5 rasterlines.. maybe that's worthwhile to you! You can save even more if you're OK with storing the clipped sprite in the 0page, in which case you can get down to 447 cycles, about 8 rasterlines..
You can also save a fair bit by only bit-masking the one column which needs it.
2010-06-02 06:57
WVL

Registered: Mar 2002
Posts: 886
True, but then you need also some if-then-else to copy back columns that dont need to be masked anymore. Basically an if-then-else per column, deciding if the column is already ok, needs to be restored to original or needs to be clipped. (restoring and clipping is just the same code except the ldx #bla, if you use the SAX routine)

Also that doesnt work if your sprite is animated ofcourse :)
2010-06-02 08:14
enthusi

Registered: May 2004
Posts: 675
I would go for a 'dumb' routine as well.
But check for dx and dy optionally.
2010-06-02 12:17
Oswald

Registered: Apr 2002
Posts: 5018
24 columns horizontally, now aint that fullscreen minus last row ? where on raster irq solves the problem: change sprite pointer to an empty sprite.
2010-06-02 12:20
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: 24 columns horizontally, now aint that fullscreen minus last row ? where on raster irq solves the problem: change sprite pointer to an empty sprite.

"24 columns horizontally" is like WTF! Either u have columns or rows, period.
2010-06-03 08:31
WVL

Registered: Mar 2002
Posts: 886
As a sidenote..

Are diagonal kefrens the same as horizontal columns or more like vertical rows?
2010-06-03 08:39
Steppe

Registered: Jan 2002
Posts: 1510
That depends on the angle. ;-)
2010-06-03 08:56
enthusi

Registered: May 2004
Posts: 675
Quote: That depends on the angle. ;-)

That's probably what makes proper roto-zooms so tough ;-)
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Mike
Dymo/G★P
csabanw
CA$H/TRiAD
Mikron
Yogibear/Protovision
t0m3000/ibex-crew
LightSide
Guests online: 147
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 S!R  (9.7)
5 Faayd  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.059 sec.