Created
September 22, 2015 02:27
-
-
Save claytical/42d321e8d781182bd1a6 to your computer and use it in GitHub Desktop.
Simple Array with Text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var selectedBall; | |
| var ballSizes; | |
| function setup() { | |
| createCanvas(windowWidth, windowHeight); | |
| selectedBall = 0; | |
| ballSizes = [40,50,30,20]; | |
| } | |
| function draw() { | |
| background(0); | |
| textSize(30); | |
| textAlign(CENTER); | |
| fill(255); | |
| stroke(127,0,127); | |
| strokeWeight(3); | |
| text("CURRENT BALL SELECTED: " + selectedBall, width/2, height/2); | |
| fill(127,127,0); | |
| noStroke(); | |
| ellipse(mouseX, mouseY, ballSizes[selectedBall], ballSizes[selectedBall]); | |
| } | |
| function mousePressed() { | |
| selectedBall++; | |
| if (selectedBall >= ballSizes.length) { | |
| selectedBall = 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment