nimo New.Internet.Master.Operator | Merci grace a toi ca marche, voila ce que j'ai changer:
  
  Code :
 - void initEnemies()
 - {
 - int i,x,y;
 - 	for (i=0;i<NUM_ENEMIES;i++){
 -   DXUSetSprite(&imgEnemy,&enemies[i].sprite,x,y); // set the sprite
 -   enemies[i].alive=TRUE;
 -   enemies[i].posx = 0;
 -   enemies[i].posy = i * 20; 
 -   enemies[i].posx=(double)enemies[i].sprite.x;
 -   enemies[i].posy=(double)enemies[i].sprite.y;
 -   enemies[i].direction.x-=5;
 -   enemies[i].direction.y=(double)(rand()%100)/100.0;
 -   enemies[i].speed=2+(double)(rand()%3);
 - 	}
 - }
 
  |  
 
   mon autre problem c'est que quand je tire une bullet, elle ne va pas horizontal mais elle va en vertical
   Es ce que je code que j'ai et mauvai?
  
  Code :
 - void initBullets()
 - {
 - int i;
 - 	for (i=0;i<NUM_BULLETS;i++){
 -   DXUSetSprite(&imgBullet,&bullets[i].sprite,0,0);	// set the sprite
 -   bullets[i].posx=bullets[i].sprite.x;    // set floating point position
 -   bullets[i].posy=bullets[i].sprite.y;
 -   bullets[i].alive=FALSE;        // set alive to false
 -   bullets[i].speed=10;        // set speed to 10 (faster than enemies)
 - 	}
 - }
 
  |  
 
  Code :
 - void renderBullets()
 - {
 - int i,j;
 - 	for (i=0;i<NUM_BULLETS;i++){
 -   if(bullets[i].alive){
 -   	// bullet is alive so move its position by mutiplying the x and y components
 -   	// by its speed. Note that these values are stored as doubles for accuracy
 -   	bullets[i].posx=bullets[i].posx+(bullets[i].direction.x*bullets[i].speed);
 -   	bullets[i].posy=bullets[i].posy+(bullets[i].direction.y*bullets[i].speed);
 -   	// round the floating point position by casting as int ready for drawing
 -   	bullets[i].sprite.x=(int)bullets[i].posx;
 -   	bullets[i].sprite.y=(int)bullets[i].posy;
 -   	//if the bullet has gone off the screen thenkill it
 -   	if(bullets[i].posx<0||bullets[i].posx>640||bullets[i].posy<0||bullets[i].posy>480){
 -     bullets[i].alive=FALSE;
 -   	}
 -   	else {
 -     // otherwise draw it
 -     DXUDrawSprite(&bullets[i].sprite);
 -     // check for collision of bullets and enemies
 -     for (j=0;j<currentTotalEnemies;j++){
 -     	if((PPSpriteCollision(&bullets[i].sprite,&enemies[j].sprite))
 -       &&enemies[j].alive&&bullets[i].alive)
 -       {
 -       // on collision kill enemy
 -       enemies[j].alive=FALSE;
 -       // invcrement enemiesKilled counter for this level
 -       enemiesKilled++;
 -       // invcrement enemiesKilled counter for all levels
 -       totalEnemiesKilled++;
 -       // kill the bullet
 -       bullets[i].alive=FALSE;
 -       // start an explosion  
 -       explosions[explodeCounter].alive=TRUE;
 -       explosions[explodeCounter].sprite.x=enemies[j].sprite.x;
 -       explosions[explodeCounter].sprite.y=enemies[j].sprite.y;
 -       explosions[explodeCounter].scale.x=1.0;
 -       explosions[explodeCounter].scale.y=1.0;
 -       explosions[explodeCounter].scaleInc=0.1;
 -       explosions[explodeCounter].transparency=255;
 -       // increment explosions counter, and reset it to 0 if itexceeds arhero bounds
 -       explodeCounter++;
 -       if(explodeCounter>=NUM_EXPLOSIONS)explodeCounter=0;
 -     	}
 -     }
 -   	}
 -   }
 - 	}
 - }
 
  |  
 
  Code :
 - void releaseBullets()
 - {
 - int i;
 - 	for (i=0;i<NUM_BULLETS;i++){
 -   	DXUReleaseSprite(&bullets[i].sprite);
 -   	DXUReleaseImage(&bullets[i].image);
 - 	}
 - }
 
  |  
 
   Merci    Message édité par nimo le 25-10-2004 à 20:56:11  ---------------
			 NEC 3500 | YAMADA 6600 | NIMO_CORP
    |