Discussion: [PSP][Aide] [OSLIB] Get pixel question
Afficher un message
Vieux 21/02/2009, 02h13   #12
pspmasterpro
Membre
 
Date d'inscription: 22/01/2009
Messages: 17
Par défaut

Thanks, I changed the 1.3 value to 1 and replaced -0 with -1 and I resized my character to 30 by 30 and it works well. I have another problem, in my game function I can't seam to use osl_keys->pressed I can only use osl_keys->held. Example here is my newGame function:
Code:
void newGame()
{
 int RLimit = 250;
 int LLimit = 50;
 int canJump = 1;
 oslReadKeys();
 oslCls();

 // Draw map and player
 oslDrawMap(mapCollision1);
 oslDrawImage(player);

 // Active gravity
 if(!collisionMgr(mapCollision1,player,0,0,0,1) && canJump == 1)
 {
  player->y += 1;
 }
 else if(collisionMgr(mapCollision1,player,0,0,0,1))
 {
  canJump = 1;
 }

 // Character movement with camera and collision detection
 if(osl_keys->held.right && !collisionMgr(mapCollision1,player,0,1,0,0))
 {
  if (player->x >= RLimit)
  {
    map1->scrollX += 1;
    mapCollision1->scrollX += 1;
  }
  else
  {
    player->x += 1;
  }
 }

 if(osl_keys->held.left && !collisionMgr(mapCollision1,player,1,0,0,0))
 {
  if (player->x <= LLimit)
  {
    map1->scrollX -= 1;
    mapCollision1->scrollX -= 1;
  }
  else
  {
    player->x -= 1;
  }
 }

 if(osl_keys->pressed.cross && !collisionMgr(mapCollision1,player,0,0,1,0))
 {
  if(canJump == 1)
  canJump = 0;
  player->y -= 3;
 }
}
The pressed.cross doesn't work, when I press (X) button nothing happens, but when I replace "pressed" with "held" it works fine but the player continously assends so I have to use pressed but it doesn't respond.

Dernière modification par pspmasterpro ; 21/02/2009 à 02h28.
pspmasterpro est déconnecté   Réponse avec citation