fisica - problem
in
Contributed Library Questions
•
2 months ago
Hello!
I made a game like this:
import fisica.*;
FWorld world;
FBox pifPaf;
void setup() {
size(800, 500);
smooth();
Fisica.init(this);
world = new FWorld();
world.setGravity(0, 300);
pifPaf = new FBox(150,40);
pifPaf.setPosition(250,500);
pifPaf.setRotation(radians(-90));
pifPaf.setStatic(true);
pifPaf.setFill(0);
pifPaf.setFriction(0);
world.add(pifPaf);
}
void draw() {
background(155);
if (random(1)<0.02)
{
FBlob b = new FBlob();
float s = random(30,40);
b.setAsCircle(random(400,750),0, s, 20);
b.setStroke(0);
b.setStrokeWeight(2);
b.setFill(255);
b.setFriction(0);
world.add(b);
}
world.step();
world.draw();
}
void keyPressed()
{
if( keyCode == LEFT)
pifPaf.setPosition (pifPaf.getX()-5,500);
if( keyCode == RIGHT)
pifPaf.setPosition ( pifPaf.getX()+5,500);
{
FCircle kula= new FCircle(30);
kula.setVelocity(1600,0);
kula.setDensity(1000);
kula.setFill(180);
kula.setPosition (pifPaf.getY(),500);
world.add(kula);
}
}
does anyone know how to make black rectangular shooting to up not to right???
Greetings
I made a game like this:
import fisica.*;
FWorld world;
FBox pifPaf;
void setup() {
size(800, 500);
smooth();
Fisica.init(this);
world = new FWorld();
world.setGravity(0, 300);
pifPaf = new FBox(150,40);
pifPaf.setPosition(250,500);
pifPaf.setRotation(radians(-90));
pifPaf.setStatic(true);
pifPaf.setFill(0);
pifPaf.setFriction(0);
world.add(pifPaf);
}
void draw() {
background(155);
if (random(1)<0.02)
{
FBlob b = new FBlob();
float s = random(30,40);
b.setAsCircle(random(400,750),0, s, 20);
b.setStroke(0);
b.setStrokeWeight(2);
b.setFill(255);
b.setFriction(0);
world.add(b);
}
world.step();
world.draw();
}
void keyPressed()
{
if( keyCode == LEFT)
pifPaf.setPosition (pifPaf.getX()-5,500);
if( keyCode == RIGHT)
pifPaf.setPosition ( pifPaf.getX()+5,500);
{
FCircle kula= new FCircle(30);
kula.setVelocity(1600,0);
kula.setDensity(1000);
kula.setFill(180);
kula.setPosition (pifPaf.getY(),500);
world.add(kula);
}
}
does anyone know how to make black rectangular shooting to up not to right???
Greetings
1