swordImg = loadImage('sword.png')
balloonImg = loadImage('balloon.png')
lineCord = [width/2, height/2, width-2 - size, height/2]
ikebotLink = createA('https://ikebot.dev/','More From Ikebot')
ikebotLink.position(width/2, 30)
background(130, 200, 130)
noFill(); stroke(255); rect(1, 1, width - 2, height - 2);
translate((lineCord[0] + lineCord[2])/2, (lineCord[1] + lineCord[3])/2);
image(swordImg, 0, 0, 40 * (lineSize/198), lineSize)
currentAngle += increaseAngleBy;
lineCord[0] = mouseX; lineCord[1] = mouseY;
lineCord[2] = mouseX; lineCord[3] = mouseY - lineSize;
newLineCord2 = rotatePoint([lineCord[2], lineCord[3]], currentAngle, [mouseX, mouseY])[0]
newLineCord3 = rotatePoint([lineCord[2], lineCord[3]], currentAngle, [mouseX, mouseY])[1]
lineCord[2] = newLineCord2; lineCord[3] = newLineCord3;
if(frameCount % balloonAddEvery === 0)balloons.push([random(width), height + 90]);
text('Lives: ' + lives, 20, 40)
text('Score: ' + score, 20, 65)
text('For Will', width/2 - textWidth('For Will')/2, height - 30)
text('Game Over', width/2 - textWidth('Game Over')/2, height/2)
text('Final Score: ' + score, width/2 - textWidth('Final Score: ' + score)/2, height/2 + 30)
function updateBalloons(){
for(var i = balloons.length - 1; i >= 0; i --){
image(balloonImg, balloons[i][0], balloons[i][1])
balloons[i][1] -= balloonSpeed;
if(balloons[i][1] <= -90){
balloons = del(i, balloons)
if(increaseAngleBy < 4)increaseAngleBy *= 1.015;
for(var i = balloons.length - 1; i >= 0; i --){
if(collideLineCircle(lineCord[0], lineCord[1], lineCord[2], lineCord[3], balloons[i][0], balloons[i][1] - 30, balloonD)){
balloons = del(i, balloons)
function rotatePoint(thePoint, rotateBy, CenterOfRotation){
xOffset = thePoint[0] - CenterOfRotation[0]
yOffset = thePoint[1] - CenterOfRotation[1]
angleOffset = atan(yOffset/xOffset)
hypotenuse = dist(thePoint[0], thePoint[1], CenterOfRotation[0], CenterOfRotation[1])
newYOffset = sin(angleOffset) * hypotenuse
newXOffset = cos(angleOffset) * hypotenuse
return [CenterOfRotation[0] + newXOffset, CenterOfRotation[1] + newYOffset];
function del(itemNo, List){
for(var i = 0; i < List.length; i++){
if(i != itemNo){newList.push(List[i])}