I want to use processing to create a creature\"Fizzy\"...which is a ball with a
ID: 3839270 • Letter: I
Question
I want to use processing to create a creature"Fizzy"...which is a ball with a red face and black eyes....
when the user presses 'w', The Fizzy should turn and move up, 'a' will make Fizzy turn and move left, 's' will turn fizzy to face down the screen and 'd' will make Fizzy move right. Thus Fizzy will now be able to move in four separate directions controlled by the 'w', 's', 'a', and 'd' keys. it will also bounce back (let's say window sideA) and turn around (head the sideB of the window)... (we only allow to use conditional(if), loops(for, while),
i dont know how to rotate the Fizzy when it bounce by the wall.. here is my codes
int x; //x coordinate of fizzy
int y; //y coordinate of fizzy
int rot; //The rotation of fizzy
int xspeed = 2; //how fast fizzy moves left and right
int yspeed = 2; //how fast Fizzy moves up and down
void setup() {
size(810, 810);
x=width/2;
y=height/2;
}
void keyPressed() {
}
void fizzy() {
fill(#FF0303); //gives fizzy a red body
ellipse(x, y, 50, 50); //draws body
fill(0); //givews fizzy black eyes
if (rot==0) { //when Fizzy is moving up the screen
ellipse(x+10, y-25, 10, 10); //draws the eyes
ellipse(x-10, y-25, 10, 10);
}
if (rot==90) { //when Fizzy is right on the screen
ellipse(x+25, y-10, 10, 10); //draws the eyes
ellipse(x+25, y+10, 10, 10);
}
if (rot==180) { //when Fizzy is moving down the screen
ellipse(x+10, y+25, 10, 10); //draws the eyes
ellipse(x-10, y+25, 10, 10);
}
if (rot==270) { //when Fizzy is right on the screen
ellipse(x-25, y-10, 10, 10); //draws the eyes
ellipse(x-25, y+10, 10, 10);
}
}
void poles() {
for (int x = 0; x <= 810; x = x +90) { //The poles are drawn in a 810x810 box being 90 pixels away from each other
for (int y = 0; y <= 810; y = y +90) {
fill(0); //Gives the poles a black colour
ellipse(x, y, 1, 1); //The pixels are 1 pixel big
}
}
}
void draw() {
background(255);
poles();
if (x>width||x<0) { //if fizzy hits the left or right wall, move the other direction
xspeed = -xspeed;
}
if (y>height||y<0) { //if fizzy hits the top or bottom wall, move the other direction
yspeed = -yspeed;
}
if (key=='w') { //moves the character up
rot=0;
y=y-yspeed;
}
if (key=='s') { //moves the character down
rot=180;
y=y+yspeed;
}
if (key=='a') { //moves the character left
rot=270;
x=x-xspeed;
}
if (key=='d') { //moves the character right
rot=90;
x=x+xspeed;
}
fizzy(); //Fizzy is drawn onto the screen
}
Explanation / Answer
Juice it. For something like ginger the you can grind it then place it in a muslin material (cheesecloth) and crush the fabric 'til all the liquid turns out. Ginger will be roughly half by mass as ginger juice. Different vegetables can be macerated in a juicer (don't do this with citrus organic product - it's repulsive without a doubt), in like manner a few herbs.
Remove it into another medium. Ordinarily this could be a sugar arrangement or water. Mechanically ethanol is utilized. Elderflowers, for instance, can be left "stewing" in a sugar arrangement until the majority of the flavor is consumed by the sugars and the blossoms have no aroma left. We've found that sugar arrangement functions admirably to separate generally enhances. On the other hand utilize water, and afterward think the flavor by bubbling off overabundance water. This is not reasonable for unstable flavors that are annihilated by utilizing excessively warm. You can separate into ethanol at home (liquor is a splendid dissolvable) by hacking up your "extractee" and placing it in a jug of vodka. This works however you must be extremely cautious about weakening of the concentrate for evident reasons.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.