Editing
Programming for Poets 2010-05-06
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
We began with the"getting started" tutorial http://processing.org/learning/gettingstarted/ We covered a little about *coordinate system *variables *program flow *functions And finished by editing a simple "pong paddle" program: void setup() { // size of our drawing window size(400, 400); // set the background color to gray background(128); } void draw() { // draw with a gray border stroke(128,128,128); // draw over the box we drew last time (at old mouse pos) fill(128); // gray drawbox(pmouseX,pmouseY); fill(255); //white // draw the new box at the new mouse position drawbox(mouseX,mouseY); } // draw a paddle-shaped box at the given coordinates void drawbox(int x, int y) { rect(30,y,10,40); } Suggested homework: The position of your pong paddle is controlled by the y variable. Make the color of your paddle change with the x position. [If you want to learn more about color, this is a *great* explanation: http://processing.org/learning/color/ What happens when you use colorMode(HSB,255)? Extra credit: make a happy face follow the mouse using the ellipse() and arc() functions. It will help to look up arc() in the reference.
Summary:
Please note that all contributions to Noisebridge are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Noisebridge:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Request account
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Dig in!
Noisebridge
- Status: MOVED
- Donate
- ABOUT
- Accessibility
- Vision
- Blog
Manual
MANUAL
Visitors
Participation
Community Standards
Channels
Operations
Events
EVENTS
Guilds
GUILDS
- Meta
- Electronics
- Fabrication
- Games
- Music
- Library
- Neuro
- Philosophy
- Funding
- Art
- Crypto
- Documentation/Wiki
Wiki
Recent Changes
Random Page
Help
Categories
(Edit)
Tools
What links here
Related changes
Special pages
Page information