This is my code... i need to get random birds drop down and kill them if they have position Y 400.
The birds are always on the same x but i need to get them random line a:
But the Brown birds always come together but i need to fix it random
- int variabele1;
- int variabele2;
- float y2;
- float y=1;
- float speed=3;
- float speed2=2;
- float speed3=2;
- float x2;
- float spawn;
- float nieuweRandom;
- float nieuweRandom2;
- float x3;
- float y3;
- import gifAnimation.*;
- PImage[] animation;
- Gif loopingGif;
- Gif nonLoopingGif;
- PImage[] animation2;
- Gif loopingGif2;
- Gif nonLoopingGif2;
- void setup() {
- size(400, 400);
- frameRate(25);
- smooth();
- oscP5 = new OscP5(this,"239.0.0.1",7777);
-
- // FGIF instelleningen voor volgen
- loopingGif = new Gif(this, "player_bird.gif");
- loopingGif.loop();
- // nonLoopingGif = new Gif(this, "player_bird.gif");
- // nonLoopingGif.play();
- // nonLoopingGif.ignoreRepeat();
- // P image Array
- //animation = Gif.getPImages(this, "player_bird.gif");
-
-
- // FGIF instelleningen voor volgen
- loopingGif2 = new Gif(this, "evil_bird.gif");
- loopingGif2.loop();
- // nonLoopingGif2 = new Gif(this, "evil_bird.gif");
- // nonLoopingGif2.play();
- // nonLoopingGif2.ignoreRepeat();
- // P image Array
- // animation2 = Gif.getPImages(this, "evil_bird.gif");
- }
- void draw() {
- nieuweRandom = random(400);
- nieuweRandom2 = random(400);
-
- // println(loopingGif.x);
- background(40,158,224);
- //x2 = random(400);
-
- //uncomment dit voor te testen. variabele1 en 2 hangen dan aan de muiscoordinaten vast
- //als de server draait, comment je deze terug.
- variabele1 = mouseX;
- variabele2 = mouseY;
-
- //speed berekening
- if (y<width) {
- y = y + speed;
- }
- //speed berekening
- if (y2<width) {
- y2 = y2 + speed2;
-
- }
- //speed berekening
- if (y3<width) {
- y3 = y3 + speed3;
- }
-
- // dit is de wolk.
- PImage d;
- d = loadImage("cloud2.png");
- image(d, x2, y2);
-
-
- if(y2 >= height){
- x2 = nieuweRandom;
- y2 = 0;
-
- }
-
- // dit is de wolk.
- PImage c;
- c = loadImage("cloud.png");
- image(c, x3, y3);
- if(y3 >= height){
- x3 = nieuweRandom2;
- y3 = 0;
- }
- //Dit is de evil vogel
- image(loopingGif2, 100, y);
- //Dit is de player vogel
- image(loopingGif, mouseX, 350);
- }