Stef devkit - Sprite drawing problem

SGDK only sub forum

Moderator: Stef

Post Reply
Maniaxe
Newbie
Posts: 4
Joined: Sat May 16, 2009 8:39 am

Stef devkit - Sprite drawing problem

Post by Maniaxe » Mon Dec 07, 2009 12:28 pm

Hi everyone!
I try to make a small project with the stef's devkit, but i have a small problem with sprites.

When i try to draw more than one sprite, only the first is drawed.

I use VDP_setSpriteP to init sprite, like this :

VDP_setSpriteP(0,24,64,SPRITE_SIZE(4,4), 0, 0);
VDP_setSpriteP(1,64,64,SPRITE_SIZE(4,4), 0, 1);
VDP_setSpriteP(2,128,64,SPRITE_SIZE(4,4), 0, 2);

But only one sprite appairs one the screen.

How can i draw 3 sprites correctly?

Thanks in advance!

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Mon Dec 07, 2009 1:09 pm

I don't know for sure, but I'm guess you should provide correct link values (last parameter of the function). Link value defines which sprite goes next in the sprite list, 0 means end of the sprite list. So, in your case the link parameters in these three function calls should be 1,2,0.

Maniaxe
Newbie
Posts: 4
Joined: Sat May 16, 2009 8:39 am

Post by Maniaxe » Mon Dec 07, 2009 1:28 pm

That's work!!!! :)

Thanks a lot for this quick reply!
Now, I can try to draw layers.. Humm

Many thks again!

Maniaxe
Newbie
Posts: 4
Joined: Sat May 16, 2009 8:39 am

Post by Maniaxe » Sun Jan 09, 2011 11:04 am

Up, one year after... ^^

I'm sorry but i would like to draw some sprites in different order.

Actually, i just want to manage drawing prority of sprites as in Crusader of Centy ( for exemple ^^ ) :

Image

I tried but when link properties aren't in order like ( 3;2;1;0 ), nothing appears.

With Gendev kit is it possible to do that?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Jan 09, 2011 12:45 pm

Sprites priority is handle by the sprite link field. Last draw sprite has the highest priority. It should work in GenDev, don't forget that a link of 0 mean the end of the list, also the list can't be more than 80 sprites (VDP stop parse after that).

For instance you can do :

Code: Select all

spr link
0   5
1   0
2   4
3   7
4   3
5   8
6   9
7   1
8   2
9   10
that means sprite will be draw in this order :
0, 5, 8, 2, 4, 3, 7, 1 end
with sprite 1 being the last drawn sprite so over all others...

Post Reply