I'm making a game where a frog has to eat flies. The flies have to move randomly around the screen, but I have no idea how to do this. I think you need a random function where the parameters are x and y. Any help on this?
int variabele1;
int variabele2;
PImage a;
void setup() {
size(600,600);
frameRate(25);
smooth();
oscP5 = new OscP5(this,"239.0.0.1",7777);
a= loadImage("Naamloos-1.png");
}
void draw() {
background(255);
image(a,0,0);
//vlieg1
PImage c;
c= loadImage("vlieg3.png");
image(c,mouseX,mouseY);
//vlieg2
c= loadImage("vlieg.png");
image(c,100,100);
//vlieg3
c= loadImage("vlieg1.png");
image(c,200,200);
//vlieg4
c= loadImage("vlieg2.png");
image(c,300,300);
//kikker
c= loadImage("kikker.png");
image(c,210,420);
//uncomment dit voor te testen. variabele1 en 2 hangen dan aan de muiscoordinaten vast
I have a question about looping backgrounds. I'm making a top down shooter with a single background that repeats. Top and bottom connect seamlessly, I'd like to know if it is possible to let it scroll down, making it basically one huge infinite background. It scrolls down currently, the problem is that nothing is drawn until the top of the image hits the bottom of the screen, only then it draws a new background.
PImage d; // image object d = loadImage("back.png"); //laadt background in als image image(d,0,y); //scrollt bg naar beneden if(y >= height){ x = bgrepeat; y = 0;} }