about sprites
Moderator: Stef
about sprites
SGDK previous version.
How to clear all sprites ?
And second question - Is possible to shift all sprites simultaneously? Or need to change coordinates of each sprite one by one ?
How to clear all sprites ?
And second question - Is possible to shift all sprites simultaneously? Or need to change coordinates of each sprite one by one ?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: about sprites
If you are using the embedded sprite engine, just call SPR_clear() to quickly hide all sprite (calling back SPR_update display them again).
You can also use the lower level method VDP_clearSprites() then VDP_updateSprites(1, ..) to hide displayed sprites.
There is no way to add global sprite shift, you indeed need to move all sprite.
You can also use the lower level method VDP_clearSprites() then VDP_updateSprites(1, ..) to hide displayed sprites.
There is no way to add global sprite shift, you indeed need to move all sprite.
Re: about sprites
Stef wrote:If you are using the embedded sprite engine, just call SPR_clear() to quickly hide all sprite (calling back SPR_update display them again).
sprites remain unchanged.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: about sprites
Are you using last SGDK ? I just tested ad it works for me.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: about sprites
Oh i missed it... so then i'm almost certain it was a bug in the previous version unfortunately :-/
Good reasons to stay on previous version ?
Good reasons to stay on previous version ?
Re: about sprites
The project is already rather large.Stef wrote:Good reasons to stay on previous version ?
I can not upgrade it for the new version.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: about sprites
Maybe you can try to just upgrade the sprite.c / sprite.h files if they don't conflict with others.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: about sprites
You were using version SGDK 1.12 ? i think you may need some changes from later rescomp, but then you will meet issues about the compression schemes which changed as well :-/ In fact i think you cannot partially update SGDK as i told you, you will meet some interaction issues.
Re: about sprites
Code: Select all
Sprite* sprites[80];
....
SPR_init(32, 256, 256);
......
if(initspider==0)
{
VDP_setPalette(PAL2, spider1.palette->data);
ind = TILE_USERINDEX;
VDP_drawImageEx(PLAN_A, &spider1, TILE_ATTR_FULL(PAL2, FALSE, FALSE, FALSE, ind), 8,8, FALSE, TRUE);
ind += spider1.tileset->numTile;
sprites[0] = SPR_addSprite(&leg1, 100, 42, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
sprites[1] = SPR_addSprite(&leg2, 83, 42, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
sprites[3] = SPR_addSprite(&leg3, 74, 107, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
sprites[4] = SPR_addSprite(&leg4, 115, 115, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
sprites[5] = SPR_addSprite(&jaw, 138, 127, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
sprites[6] = SPR_addSprite(&leg1, 175, 41, TILE_ATTR(PAL2, TRUE, FALSE, TRUE));
sprites[7] = SPR_addSprite(&leg2, 177, 42, TILE_ATTR(PAL2, TRUE, FALSE, TRUE));
sprites[8] = SPR_addSprite(&leg3, 178, 107, TILE_ATTR(PAL2, TRUE, FALSE, TRUE));
initspider=1;
....
SPR_update(sprites, 80);
}
why do not display sprites?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: about sprites
You are probably hitting the sprite limit per scanline. Currently rescomp does not optimize the sprite tiles so when you use big sprites as here you quickly reach the scanline sprite limitation. I should rewrite the sprite tile decomposition part but in fact the optimization process involved is not really trivial. You have to find a good balance between the number of VDP sprite and the scanline limit...
Re: about sprites
Stef wrote:You are probably hitting the sprite limit per scanline.
oh... you're right
I'm overestimated capabilities of the sprite-generator
Re: about sprites
I used a for loop the other day to draw the same sprite over and over in a horizontal line
and found out that the line of sprites (each one 8x8 pixels) only covered 1/3rd of the screen.
Which made me think I might have to do the shooting differently than drawing a line of sprites.
I realized that other demos and games had lots of sprites going in curves so maybe there's that
way around this? Could the sprites be drawn on another vertical line yet look just about the same?
and found out that the line of sprites (each one 8x8 pixels) only covered 1/3rd of the screen.
Which made me think I might have to do the shooting differently than drawing a line of sprites.
I realized that other demos and games had lots of sprites going in curves so maybe there's that
way around this? Could the sprites be drawn on another vertical line yet look just about the same?
Re: about sprites
The limit is 20 sprites per line (in the default 320px mode), how much area it covers depends on the sprite size. So use larger sprites and you can cover the entire screen.