Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can Someone draw this image using Processing? 1) Set the window size as 600 by 6

ID: 3604804 • Letter: C

Question

Can Someone draw this image using Processing?

1) Set the window size as 600 by 600;

(2) Set global variables x and y as the center of the head, and draw the rest of the body parts relative to the head position (x and y) - use one function named as “drawStickFigure” to draw the stick figure on the screen with position x and y; and draw the rest of the body parts using separate functions (methods) for drawing each part of the stick figure (e.g. head, body, arm);

(3) Set random color to the stick figure for each frame.

(4) Use variables, bouncing-ball example, and the trigonometry we discussed in class to create walking back-and-forth animation of the stick figure. (Hints: two legs’ movement can be animated using trigonometry; while walking back and forth across screen can be done by setting conditions for position x).

Explanation / Answer

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stickman;

import java.awt.*;

import java.applet.Applet;
import java.awt.*;

public class StickFigure extends Applet
{
public void paint (Graphics gp)
{
setBackground(Color.black);
setForeground(Color.red);
gp.drawRect(5,5,190,190);
gp.drawOval(90,60,20,20);
gp.drawLine(100,80,100,120);

gp.drawLine(100,100,80,100);
gp.drawLine(100,100,120,75);
gp.drawLine(100,120,85,135);
gp.drawLine(100,120,115,135);
gp.drawString("Stick Figure", 20, 180);

}
  
}

stick.html

<html>
<head>
<title>Stick Figures</title>
</head>
<body>
<p>Hello World Applet

<applet code="StickFigure.class" width=300 height=200>
</applet>

</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote