Microsoft Word - Document1 ALL CODE MUST BE DONE IN PROCESSING SOFTWARE, FREE SOFTWARE DOWNLOAD ON processing.org MUST WRITE NOTES EXPLAINING EACH STEP OF CODE PLEASE SUBMIT A ZIPPEDFILE of the...

1 answer below »
Assignment requirements and video example attached below,All code must be done in processing software, free software download on processing.orgMust write notes explaining each step of code


Microsoft Word - Document1 ALL CODE MUST BE DONE IN PROCESSING SOFTWARE, FREE SOFTWARE DOWNLOAD ON processing.org MUST WRITE NOTES EXPLAINING EACH STEP OF CODE PLEASE SUBMIT A ZIPPEDFILE of the folder containing 1. Egg.pde 2. EggHunt.pde Pointswillbetakenoffifsubmittedasindividualfiles. Let us playEggHuntwithProcessing :) WritecodetocreateaclassEggwithfollowingfields/properties/attributes: • x - to store x coordinate of center of Egg - data type - float • y - to store y coordinate of center of Egg - data type - float • clr - color of the Egg - data type - color • shape - instead of candy inside the egg, there is a shape - data type - int • avalue1correspondstoarectangle • a value2corresponds to a square • a value 3 corresponds to a circle • a value 4 corresponds to a ellipse • a value 5 corresponds to a triangle ClassEggimplementsthefollowingmethods(write code for the following methods) : 1. OnlyoneConstructorthat: • takes 2 arguments - both as datatypefloat- for x & y coordinates of where Egg should be placed. • Steps to be done inside constructor : • assign the 2 incoming arguments to appropriate attributes. • assign random color to the attribute clr. • assign a random integer value between 1 through 5 - corresponding shapes are given while this field was described above. 2. show • doesnotreturnanything • noinputarguments • goalistodrawanellipse(100by150)withit'scolor(whyellipse? becausethisisaneggthatwearecreatingincanvas). 3. open o doesnotreturnanything o noinputarguments o ifthisinstanceofEggisclicked:(can use dist() function - doing this for ease of use - it won't be perfect) o callshow() o fillwithacolorthatisincontrastwiththecolorofthisEggand thendependingonthevalueofshape,drawthecorrespondingshape toappearinsideit Usage file - file that uses Egg - name it as EggHunt : Needs to maintain an array of Egg. Inside setup(), • define the size of the egg hunt playing ground (size of the canvas :) ) • make background to be green (to simulate grass). • use a loop that runs 50 times : (Basically we are creating 50 Eggs on the ground) • create a new Egg (Egg need to be placed randomly across the canvas) • append this new Egg to array of Eggs • call show() of this newly created Egg. Inside mousePressed(), use a loop to call open() of each Egg in the array. draw() does not have any code in it as there is no need to animate anything. Lavf57.37.101
Answered 1 days AfterNov 09, 2021

Answer To: Microsoft Word - Document1 ALL CODE MUST BE DONE IN PROCESSING SOFTWARE, FREE SOFTWARE DOWNLOAD ON...

Sathishkumar answered on Nov 10 2021
126 Votes
Egg Egg1;
int shape=0;
int[] neweggs_x = new int[50];
int[] neweggs_y = new int[50];
float[] dva
lue = new float[50];
float[] cr = new float[50];
float[] cg = new float[50];
float[] cb = new float[50];
int a, a1;
void setup() {
size(1500, 800);
background(0, 255, 0);
noStroke();
for (a1 = 0; a1 <50; a1 ++)
{
int y = int(random(height));
int x = int(random( width));
neweggs_x[a1]=x;
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here