Created
          November 24, 2015 19:51 
        
      - 
      
- 
        Save indefinit/894080ca56bdd86dc291 to your computer and use it in GitHub Desktop. 
    Tall-short-example
  
        
  
    
      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
    
  
  
    
  | //code by: | |
| // https://github.com/Jared-Sprague | |
| var spriteSheet; | |
| var tall = 220;; | |
| var short = 260; | |
| var plantPosX = tall;//our plant position defaults to our tall position | |
| function setup() { | |
| createCanvas(600, 600); | |
| background(200); | |
| spriteSheet = loadImage('image/sprite_sheet.jpg'); | |
| } | |
| function draw() { | |
| image(spriteSheet, plantPosX, 20, 40, 110, spriteSheet.width + 60, 200, 40, 100); | |
| } | |
| function mousePressed () { | |
| if(plantPosX === tall){ | |
| plantPosX = short; | |
| } else { | |
| plantPosX = tall; | |
| } | |
| print("tall is ", tall); | |
| print("short is ", short); | |
| println("plantPosX is ", plantPosX); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment