Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » pivot_sprite() doesn't seem to work...

Credits go to Evert and gnolam for helping out!
This thread is locked; no one can reply to it. rss feed Print
pivot_sprite() doesn't seem to work...
James Stanley
Member #7,275
May 2006
avatar

pivot_sprite() doesn't work. I would show you a snippet, but it said it wasn't formatted properly :-/. I am trying to use pivot_sprite() to draw the limbs of the players, but it doesn't do anything. It draws it vertically like I drew it in my image editor. Even when I set it to a fixed value (64), it still doesn't pivot it. Any ideas?

gnolam
Member #2,030
March 2002
avatar

Yes. Try showing us the snippet again.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

James Stanley
Member #7,275
May 2006
avatar

//Put the correct angle in (I've tested the deg2alleg function)
  pivot_sprite(bmp, leftua[0], (player->x + headradius + 3), (player->y - (bodylength + 45)), 5, 5, (fixed)deg2alleg((float)player->laa));
//Draw it at 64 Allegro degrees (right angle)
  pivot_sprite(bmp, leftua[0], (player->x + headradius + 3), (player->y - (bodylength + 45)), 5, 5, 64);

Both draw it just like draw_sprite() would.

Evert
Member #794
November 2000
avatar

Random guess: you're passing the integer 64 instead of itofix(64).

EDIT: damnit, I'm slow! :(
I was right though...:P

James Stanley
Member #7,275
May 2006
avatar

:o Wow. That worked. Just trying something else...

EDIT:
You're slow? Matter of seconds!

If I pass the following it works right. So I'm happy. Thank you. :)

itofix((int)deg2alleg((float)-player->laa))

Go to: