Object not continuing after I let go of mouse button! Help please!
in
Programming Questions
•
1 year ago
Does anyone know why I can't get the bullet coming from megaman's arm to continue going after i left go of the mouse button? I tried using mouseclicked() but it only showed the bullet at the starting point and it would soon after disappear. Also, Is there a way to keep sending out bullets? At the moment, I can only shoot once per run and every time i press down on the mouse button, it shows the bullet where i let go of the mouse button. Any tips? Thanks in advance for your help!
PImage megaman1;
PImage megaman2;
int x=0;
void setup() {
size(800, 315);
megaman1 = loadImage("megaman1.png");
}
void draw() {
background(255);
image(megaman1,0,0);
if (mousePressed == true) {
megaman2 = loadImage("megaman2.png");
image(megaman2,0,0);
fill(251, 255, 44);
noStroke();
rect(400+x,143, 50, 20);
x=x+10;
}
}
PImage megaman1;
PImage megaman2;
int x=0;
void setup() {
size(800, 315);
megaman1 = loadImage("megaman1.png");
}
void draw() {
background(255);
image(megaman1,0,0);
if (mousePressed == true) {
megaman2 = loadImage("megaman2.png");
image(megaman2,0,0);
fill(251, 255, 44);
noStroke();
rect(400+x,143, 50, 20);
x=x+10;
}
}
1