How put my sprites into new SGDK project?
Moderator: Stef
How put my sprites into new SGDK project?
Have a set of sprites 48 * 48, located in different BMP files.
How to import them into my project?
And also to create animations and displaying multiple sprites on different layers.
For compilation I set up CodeBlocks.
How to import them into my project?
And also to create animations and displaying multiple sprites on different layers.
For compilation I set up CodeBlocks.
Last edited by alko on Thu Nov 19, 2015 5:22 pm, edited 3 times in total.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: How put my sprites into new SGDK project?
Get a look on the included "sprite" sample (in sample SGDK folder). You will see a gfx.res file in 'res' folder which define the sprites resources.
You can have more informations about how to define resources with rescomp.txt file (in 'bin' folder this time).
You can have more informations about how to define resources with rescomp.txt file (in 'bin' folder this time).
Re: How put my sprites into new SGDK project?
violated palette indexes.
And instead of a transparent color - white color.
And instead of a transparent color - white color.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: How put my sprites into new SGDK project?
Can you edit the palette with Paint.NET ? I guess your palette is not correctly set, you can arrange it with gimp 2 for instance.
The transparent color should be correctly handled by rescomp but maybe i've a bug here, i will check that !
The transparent color should be correctly handled by rescomp but maybe i've a bug here, i will check that !
Re: How put my sprites into new SGDK project?
I've had problems with transparency I don't think they work :/
Re: How put my sprites into new SGDK project?
Transparent color should be first in palette indexes.
By the way, sample with sonic sprites unoptimized.
Example Violence Pingouin better in terms of drawing sprites\tiles, but source more difficult for a beginner.
By the way, sample with sonic sprites unoptimized.
Example Violence Pingouin better in terms of drawing sprites\tiles, but source more difficult for a beginner.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: How put my sprites into new SGDK project?
Definitely the way the sprite engine work is not optimized currently but the next SGDK version will include major changes to make it faster and more efficient... I will look into that transparent color issue, if you look at the sonic sample, the transparent color is not at index 0 but it's referenced as the transparent color in the PNG file an rescomp does handle it correctly
Re: How put my sprites into new SGDK project?
I'm trying display second sprite
occurs conflict of palettes
occurs conflict of palettes
Code: Select all
SPR_initSprite(&sprites[0], &x_sprite, fix32ToInt(posx - camposx), fix32ToInt(posy - camposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
SPR_update(sprites, 1);
SPR_initSprite(&sprites[1], &ball_sprite, fix32ToInt(posx - camposx), 10, TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
SPR_update(sprites, 2);
Code: Select all
SPRITE ball_sprite "ball.png" 4 4 -1
SPRITE x_sprite "x1.png" 8 4 -1
Re: How put my sprites into new SGDK project?
Check the arrows surrounding the "PAL2" text. It's using the same palette line as the first sprite, so just change it to the appropriate palette file. (Unless it was intended for both sprites to share it, in that case, your sprite needs to be fixed to use the proper palette entries).alko wrote:Code: Select all
SPR_initSprite(&sprites[1], &ball_sprite, fix32ToInt(posx - camposx), 10, TILE_ATTR( ---->PAL2<----, TRUE, FALSE, FALSE)); SPR_update(sprites, 2);
Re: How put my sprites into new SGDK project?
Bat tiles climb on background (320*240).
necessary move bat tiles in VDP RAM
and incomprehensible where did this blue color.
in color table it is not present
necessary move bat tiles in VDP RAM
and incomprehensible where did this blue color.
in color table it is not present
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: How put my sprites into new SGDK project?
Color index 0 is transparent so you always have to take care of that, the blue color come from the background color (which is set to palette 0 index 0 by default).
And you can fill palette entry with the classic VDP_setPalette(..) method.
For instance for your ball sprite :
And you can fill palette entry with the classic VDP_setPalette(..) method.
For instance for your ball sprite :
Code: Select all
VDP_setPalette(PAL3, ball_sprite.palette->data);
Re: How put my sprites into new SGDK project?
how to display an array sprites ?
that's right ?
that's right ?
Code: Select all
int i;
for(i=0;i<150;i++){
SPR_initSprite(&sprites[i], &rain_sprite, i, i, TILE_ATTR(PAL3, TRUE, FALSE, FALSE));
SPR_update(sprites, i+1);
}
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: How put my sprites into new SGDK project?
alko wrote:how to display an array sprites ?
that's right ?Code: Select all
int i; for(i=0;i<150;i++){ SPR_initSprite(&sprites[i], &rain_sprite, i, i, TILE_ATTR(PAL3, TRUE, FALSE, FALSE)); SPR_update(sprites, i+1); }
Almost
Code: Select all
int i;
for(i=0;i<80;i++)
SPR_initSprite(&sprites[i], &rain_sprite, i, i, TILE_ATTR(PAL3, TRUE, FALSE, FALSE));
SPR_update(sprites, 80);
Re: How put my sprites into new SGDK project?
That is what is there for now:
I want to add decorations.
but how to avoid the restriction of sprites?
to be seen "blood" particles and background decorations (for example, chain and scrolling fog ).
P.S.: PC-version https://youtu.be/96-FxYu_Fr0?list=PLvUf ... xhG17X6zNS
I want to add decorations.
but how to avoid the restriction of sprites?
to be seen "blood" particles and background decorations (for example, chain and scrolling fog ).
P.S.: PC-version https://youtu.be/96-FxYu_Fr0?list=PLvUf ... xhG17X6zNS