Annonce

>>> Bienvenue sur codelab! >>> Première visite ? >>> quelques mots sur codelab //// une carte des membres//// (apéros) codelab


#1 2015-05-02 12:18:57 Demande d'aide pour un jeu sur processing

muse
membre
Date d'inscription: 2015-05-02
Messages: 15

Demande d'aide pour un jeu sur processing



Bonjour à tous, je suis nouvelle sur ce forum et viens de commencer la programmation cette année.
Ayant choisi la spécialité ISN au bac, je dois réaliser un jeu sur processing, mais voilà, je suis bloquée et fais donc appel à votre aide. Il s'agit d'un jeu où l'on doit réaliser un hamburger mais mon probléme est que les aliments ne s'empile pas tous correctement, de plus  j'ai du mal a faire tomber mes objets de façon répétitive. sad
Voici mon programme:

int fond;// variable globale qui permettra d'empiler les aliments.
float x;
float y;
float vitesse;
PImage painporteur;
PImage salade;
PImage cornichon;
PImage fromage;
PImage oignon;
PImage pain;
PImage steak;
PImage tomate;
Painporteur monPainporteur = new Painporteur();
Salade maSalade= new Salade(5);
Cornichon monCornichon = new Cornichon(5);
Fromage monFromage = new Fromage(5);
Oignon monOignon = new Oignon(5);
Pain monPain = new Pain(5);
Steak monSteak = new Steak(5);
Tomate maTomate = new Tomate(5);

void setup(){
  size(1300,675);
  smooth();
  painporteur=loadImage("painporteur.png");
  salade=loadImage("salade.png");
  cornichon=loadImage("cornichon.png");
  fromage=loadImage("fromage.png");
  oignon=loadImage("oignon.png");
  pain=loadImage("pain.png");
  steak=loadImage("steak.png");
  tomate=loadImage("tomate.png");
 
}


void draw(){
  background(0);
  cursor(HAND);
  monPainporteur.display();
 
  maSalade.contact();
  maSalade.display();

  monCornichon.display();
  monCornichon.contact();
 
  monFromage.display();
  monFromage.contact();
 
  monOignon.display();
  monOignon.contact();
 
  monPain.display();
  monPain.contact();
 
  monSteak.display();
  monSteak.contact();
 
  maTomate.display();
  maTomate.contact();
 
 
}

class Painporteur{
float x;
float y;

Painporteur(){
   x=0;
   y=665;
}
 
  void display() {
    stroke(0);
    fill(175);
    if (mouseX<width-130) x = mouseX;
    else x=width-130;
    image(painporteur,x,600);
  }   
}

class Salade{
  float x;
  float y;
  float vitesse;
  int fond=580;
  int touche;//il a atterri sur le sandwich
Salade( float nouvY){
  x=random(30,1160);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
void display(){
  image(salade,x,y,175,300);
  y+=vitesse;
}
  void contact(){
     if(((y<fond)&&( y>fond-10))&&((x>monPainporteur.x-15)&&(x<monPainporteur.x+15))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x;
                         
}}

class Cornichon{
  float x;
  float y;
  float vitesse;
  int fond=500;
  int touche;//il a atterri sur le sandwitch
Cornichon(float nouvY){
  x=random(30,1160);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
 
void display(){
  image(cornichon,x,y);
  y+=vitesse;
}
void contact(){
     if(((y<fond)&&( y>fond-10))&&((x>monPainporteur.x-15)&&(x<monPainporteur.x+15))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x;
                         
}}

class Fromage{
  float x;
  float y;
  float vitesse;
  int fond=600;
  int touche;//il a atterri sur le sandwitch
Fromage(float nouvY){
  x=random(30,1105);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
 
void display(){
image(fromage,x,y);
  y+=vitesse;
}
void contact(){
     if(((y<fond)&&( y>fond-10))&&((x>monPainporteur.x-15)&&(x<monPainporteur.x+15))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x;
                         
}}

class Oignon{
  float x;
  float y;
  float vitesse;
  int fond=500;
  int touche;//il a atterri sur le sandwitch
Oignon(float nouvY){
  x=random(30,1145);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
 
void display(){
  image(oignon,x,y);
  y+=vitesse;
}
void contact(){
     if(((y<fond)&&( y>fond-30))&&((x>monPainporteur.x-30)&&(x<monPainporteur.x+30))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x;
                         
}}

class Steak{
  float x;
  float y;
  float vitesse;
  int fond=555;
  int touche;//il a atterri sur le sandwitch
Steak(float nouvY){
  x=random(30,1100);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
 
void display(){
  image(steak,x,y);
  y+=vitesse;
}
void contact(){
     if(((y<fond)&&( y>fond-30))&&((x>monPainporteur.x-30)&&(x<monPainporteur.x+30))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x+25;
                         
}}

class Tomate{
  float x;
  float y;
  float vitesse;
  int fond=625;
  int touche;//il a atterri sur le sandwitch
Tomate(float nouvY){
  x=random(30,1125);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
 
void display(){
  image(tomate,x,y);
  y+=vitesse;
}
void contact(){
     if(((y<fond)&&( y>fond-30))&&((x>monPainporteur.x-30)&&(x<monPainporteur.x+30))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x;
                         
}}

class Pain{
  float x;
  float y;
  float vitesse;
  int touche;//il a atterri sur le sandwitch
Pain(float nouvY){
  x=random(30,1110);
  y=nouvY;
  vitesse=random(1,1.5);
  touche=0;
  }
 
void display(){
image(pain,x,y);
  y+=vitesse;
}
void contact(){
     if(((y<fond)&&( y>fond-30))&&((x>monPainporteur.x-30)&&(x<monPainporteur.x+30))){
        vitesse = 0; fond=fond-40;
        touche =1;}
     if (touche==1) x=monPainporteur.x;
                         
}}

Je vous remercie par avance, en espérant recevoir des réponses car c'est urgent. smile

Dernière modification par muse (2015-05-02 13:51:25)

Hors ligne

 

#2 2015-05-02 13:25:01 Re : Demande d'aide pour un jeu sur processing

Mushussu
membre
Lieu: Orléans
Date d'inscription: 2012-05-24
Messages: 802

Re: Demande d'aide pour un jeu sur processing



Bonjour,

Avant de pouvoir regarder ce qui cloche, il serait bon que tu envoies tout ton dossier avec les images, car nous ne pouvons t'aider que si nous avons tout les éléments.
Tu peux compresser le dossier du sketch en .zip et le joindre au message de codelab.
De plus, il est préférable de poser ta question dans la partie Processing de codelab.
Bon courage.

Hors ligne

 

#3 2015-05-02 13:53:02 Re : Demande d'aide pour un jeu sur processing

muse
membre
Date d'inscription: 2015-05-02
Messages: 15

Re: Demande d'aide pour un jeu sur processing



Ah oui j'avais oublié de l'envoyer, merci, je viens de l'ajouté au message

Hors ligne

 

fil rss de cette discussion : rss

Pied de page des forums

Powered by FluxBB

codelab, graphisme & code : emoc / 2008-2024