Foros - Stratos

Proyectos => CRM32Pro => Mensaje iniciado por: Mikenoworth en 10 de Enero de 2007, 09:42:43 PM

Título: CRM32Pro_CSprite::SetPosition(x, y, 1 ?? )
Publicado por: Mikenoworth en 10 de Enero de 2007, 09:42:43 PM
// cascades the sprites
CRM32Pro_CSprite* cspr = get_spr(spr2);
cspr->SetPosition(10, 10, 0);
cspr = get_spr(spr3);
//cspr->SetPosition(20, 20, 0);
cspr->AutoRestore(0);

//cspr = NULL;

int x = 60, y = 60;

while(!done)
{      
++x; ++y;
cspr->SetPosition(x, y, 1);
spr_man_logic();

while(CRM32Pro.Update(&event))
{
switch(event.type)
{
case SDL_MOUSEBUTTONDOWN:                
break;
case SDL_QUIT:
done = 1;
break;
case SDL_KEYDOWN:
if(event.key.keysym.sym == SDLK_ESCAPE) done = 1;                    
break;
default:
break;
}
}
}


I've tried multiple methods, but the result is always the same - The sprite seems to repeat the path, drawing copies of itself throughout the path.

I've done exactly what the rabbit example does with movement. yet, it's crud. What did I miss?

spr_man_logic() simply sorts the sprites on a per layer basis, and checks for collision, it does nothing with the sprites position.
Título: CRM32Pro_CSprite::SetPosition(x, y, 1 ?? )
Publicado por: TheAzazel en 10 de Enero de 2007, 11:24:28 PM
Mike, I would need a full compileable example to check in my computer what´s going on, so, could you isolate that piece of code? (render callback included)

I will go on leave until next Sunday so you have to use some of your patient hehehe

cheers!

P.S.: although.. I can see you disable the autorestore of the sprite so in your render callback, you have to blit the whole background image before to draw each sprite.
Título: CRM32Pro_CSprite::SetPosition(x, y, 1 ?? )
Publicado por: Mikenoworth en 13 de Enero de 2007, 01:07:37 AM
This is bad to say, but as I was debugging and cleaning up code, the problem went away.  :?:  So I don't know why it was happening but again.. it is gone.   :roll:
Título: CRM32Pro_CSprite::SetPosition(x, y, 1 ?? )
Publicado por: TheAzazel en 15 de Enero de 2007, 12:33:02 AM
Well, that was fine then :)

we are longing for a release of your game!!!

Cheers!
Título: CRM32Pro_CSprite::SetPosition(x, y, 1 ?? )
Publicado por: Mikenoworth en 15 de Enero de 2007, 09:17:59 PM
I want the same thing, but bad game design and the need for editors slows game progress.

  I'm working on it at least 8 hrs day.   :)