can someone pls help me with allegro, i have all the keys setup as below
wondering how i would go about creating an idle state, which would work by probably reading the last key hit, namely key left or key right and when user stops pressing the key the character is facing that way etc
pls lend a hand ive pulled all my hair
int newxpos, newypos;
if (key[KEY_RSHIFT]&&(key[KEY_RIGHT])) {
newxpos = xpos + 20;
newypos = ypos - 20;
if (newypos > backgroundheight)
newypos = backgroundheight;
if (newxpos>backgroundwidth) // If the new x-coordinate exceeds the width of the world then set
newxpos = backgroundwidth;
playerSprite->setSpriteState(JUMP_RIGHT);
} else if (key[KEY_RSHIFT]&&(key[KEY_LEFT])) {
newxpos = xpos - 20;
newypos = ypos - 20;
if (newypos > backgroundheight)
newypos = backgroundheight;
if (newxpos>backgroundwidth) // If the new x-coordinate exceeds the width of the world then set
newxpos = backgroundwidth;
playerSprite->setSpriteState(JUMP_LEFT);
} else if (key[KEY_RCONTROL]&&(key[KEY_LEFT])) {
newxpos = xpos - 5;
newypos = ypos;
playerSprite->setSpriteState(CROUCH_CRAWL_LEFT);
any help appreciated
fonz

New Topic/Question
Reply




MultiQuote




|