Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

correct and run eclipse code: Tiles1=========================================== import processing.core.PApplet; public class Tiles1 extends PApplet { DogPics dogs ; RandomSpotter spots ; public static void main(String[] args)

correct and run eclipse code: Tiles1=========================================== import processing.core.PApplet; public class Tiles1 extends PApplet { DogPics dogs ; RandomSpotter spots ; public static void main(String[] args) { PApplet.main("Tiles1"); } public void settings() { size(900, 900); } public void setup ( ) { background ( 0 ) ; dogs = new DogPics ( this, 300, 300, 300 ) ; spots = new RandomSpotter ( this, 0, 0, 300 ) ; } public void draw ( ) { dogs.animate ( 1 ) ; spots.animate( 1 ) ; } } \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Tile1A//////////////////////////////////// public class Tiles1A { protected int xloc ; protected int yloc ; protected int size ; protected PApplet theSketch ; ; void Tile1A( PApplet parentSketch, int pX, int pY, int pSize ) { xloc = pX ; yloc = pY ; size = pSize ; theSketch = parentSketch ; } void Tile1A ( ) { } void animate ( int nRepeats ) { } void blank ( ) { } void killTime ( int millis ) { int startTime = theSketch.millis ( ) ; int endTime = startTime + millis ; while( theSketch.millis( ) < endTime ) ; } void clipGraphics( ) { theSketch.clip(xloc, yloc, size, size); } } ; /////////////////////////////////////////////////// Tiles1B \\\\\\\\\\\\\\\\\\\\\\\\ import java.util.ArrayList; import processing.core.PApplet; class RandomSpotter extends Tiles1 { class Spot { public int x ; public int y ; public int theColor ; public int diameter ; public Spot( int pX, int pY, int pColor, int pDiameter ) { x = pX ; y = pY ; diameter = pDiameter ; theColor = pColor ; } } ; ArrayList spots = new ArrayList ( ) ; int nSpots = 0 ; final static int maxSpots = 10 ; RandomSpotter ( PApplet pSketch, int pX, int pY, int pSize ) { super( ) ; } @SuppressWarnings("null") void animate ( int nReps ) { getGraphics ( ) ; PApplet theSketch = null; float size = 0; int x = ( int ) theSketch.random( ( float ) size ) ; int y = ( int ) theSketch.random( ( float ) size ) ; int theColor = theSketch.color( 120, 50, 240 ) ; Spot spot = new Spot ( x, y, theColor, (int)( theSketch.random ( 30 ) ) ) ; spots.add( spot ) ; nSpots ++ ; if(nSpots > maxSpots ) { Spot tmp = spots.remove(0) ; theSketch.fill ( 0 ) ; theSketch.ellipse( tmp.x, tmp.y, tmp.diameter, tmp.diameter ); nSpots -- ; } for( Spot s : spots ) { theSketch.fill( s.theColor ) ; theSketch.ellipse( s.x, s.y, s.diameter, s.diameter ) ; } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

Discuss the effectiveness of a national infrastructure for HRD

Answered: 1 week ago