The Sparkfun Guide to Processing by Derek Runberg
Author:Derek Runberg
Language: eng
Format: epub, mobi
Publisher: No Starch Press, Inc.
Published: 2015-09-03T04:00:00+00:00
Driving Shapes
Making something move on the screen in response to the keyboard or mouse is a basic building block of video game development. Let’s start simple and use the arrow keys to send an ellipse zooming around the sketch window.
Since you want to move the ellipse, you need to be able to change its x- and y-coordinates. First, in the code window, create global variables for those values:
int x = 300;
int y = 300;
Start your ellipse in the middle of the sketch window. In my example, the center is (300,300). Yours may be different, if you change the size of your sketch window.
Now write the setup() and draw() calls:
void setup()
{
size(600,600);
}
void draw()
{
background(150);
fill(255,0,0);
noStroke();
ellipse(x,y,50,50);
}
Download
The Sparkfun Guide to Processing by Derek Runberg.mobi
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Kathy Andrews Collection by Kathy Andrews(11270)
Thirteen Reasons Why by Jay Asher(8397)
The Red Files by Lee Winter(3251)
How to Do Nothing by Jenny Odell(3079)
The Genius of Japanese Carpentry by Azby Brown(3009)
Stacked Decks by The Rotenberg Collection(2662)
Tattoo Art by Doralba Picerno(2463)
Champions of Illusion by Susana Martinez-Conde & Stephen Macknik(2301)
The Artist's Way Workbook by Cameron Julia(2062)
The Art of Doom by Bethesda(2023)
Calligraphy For Dummies by Jim Bennett(1882)
Creative Character Design by Bryan Tillman(1820)
Botanical Line Drawing by Peggy Dean(1751)
One Drawing A Day by Veronica Lawlor(1709)
Wall and Piece by Banksy(1699)
The Art of Creative Watercolor by Danielle Donaldson(1698)
Art Of Atari by Tim Lapetino(1544)
Pillars of Eternity Guidebook by Obsidian Entertainment(1519)
Happy Hand Lettering by Jen Wagner(1508)
