sketch.js
//attaching new bird when space is pressed and when in launched state

attaching new bird when space is pressed and when in launched state
attaching new bird when space is pressed and when in launched state
function keyPressed(){
    if(keyCode === 32 && gameState === "launched"){
        Body.setPosition(birds[birds.length-1].body,{x:200,y:50});
        slingshot.attach(birds[birds.length-1].body);
        birdselectsound.play();
        gameState="onSling";
    }
}
function keyPressed ( ) { if ( keyCode === 32 && gameState === "launched" ) { Body . setPosition ( birds [ birds . length - 1 ] . body , { x : 200 , y : 50 } ) ; slingshot . attach ( birds [ birds . length - 1 ] . body ) ; birdselectsound . play ( ) ; gameState = "onSling" ; } }
attaching new bird when space is pressed and when in launched state
attaching new bird when space is pressed and when in launched state