Last active
September 10, 2016 18:48
-
-
Save albertochiwas/b6b37303c9a828e337f41adfd458c0bd to your computer and use it in GitHub Desktop.
Version inicial patea bola
This file contains 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 bola = { | |
r:30, col:color(224, 85, 168), | |
x:190, y:50, | |
rep:0, sube:false | |
}; | |
var pantera = { | |
av: new Avatar(5), | |
x:150, y:180, | |
go: true, | |
rep:0 | |
}; | |
var animaBola = function() { | |
if (bola.sube) { // subiendo? | |
if (--bola.y<90) { | |
bola.sube=false; | |
} | |
} else { // bajando! | |
if (++bola.y>180) { | |
bola.sube=true; | |
} | |
} | |
fill(bola.col); | |
ellipse(bola.x,bola.y,bola.r,bola.r); | |
}; | |
pantera.av.scale(0.75); | |
var pausa = false; | |
pantera.av.setLimit(6,-90,0); | |
pantera.av.setAngle(6,1); | |
pantera.av.setAngle(7,75); | |
var draw = function() { | |
background(240, 232, 240); | |
animaBola(); | |
if (pantera.go) { | |
pantera.av.next(6); | |
var pos = pantera.av.getAngle(6); | |
if (pos>=0) { | |
if (++pantera.rep > 2) { | |
pantera.av.setAngle(7,0); | |
pantera.go = false; | |
} | |
} | |
} | |
pantera.av.draw(pantera.x,pantera.y); | |
}; | |
var mouseClicked = function() { | |
pausa = !pausa; | |
if (pausa) { | |
noLoop(); | |
} else { | |
loop(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment