The 5th and Final submission for the “5-in-5” Major Studio.

Yes, so ending this with one more coding project. Again, a two-hour sprint! I really did not have an idea for my final coding project. There was nothing at this moment that I want to learn or make a change or give something to reflect on. So then what do you do? Well… as always, just have fun!

Post-Bootcamp, I never got a chance to work on processing. Also, I never actually worked on p5 before, unless for some exercises in class. Well, here we are!
So this is just me, having fun, playing with creative coding, and learning p5 and JS a little more in the knick of time.


Interestingly, the idea emanated from the fact that I could not actually zero in on an idea, and I really had to complete this 5-chained project. Well, you have p5 for the 5th! So in the words of Megamind… just focus now on “PRESENTATION!” I created a Megamind inspired villain to tease this grueling week of 5-in5- projects and yes, the villain’s name was… p5, 5 people in one! Muhuhahaha!

Process and Goal

I sketched out my villain on my iPad and dressed him up a bit with Photoshop. I used some evil sounds, and just simply went around playing with the animations possible in the given time.  I stuck to keeping the characters to 5, as 5 is all I wanted.

Constraints: You have two-hour sprint! Go!
Goal: Have fun!
Improvements: Finesse!
Product: Here’s the code of sketch.js.

var body, bodyImage;
var MARGIN=40;
var song;
var xPos = 100;
var yPos = 50;

var ghosts;
var ghostCount=0;

function setup() 
bg = loadImage("assets/lightning.jpg");
// song = loadSound("assets/thundersound.mp3");
body = createSprite(width/2, height/2);
bodyImage = loadImage("assets/body.png");
ghostImage = loadImage("assets/ghost.png");
body.addImage("normal", bodyImage);
body.addAnimation("power", "assets/bodyspread.png");
body.maxSpeed = 4;
body.friction = 0.98;
//change sound
laser = loadSound("assets/evilsound.mp3");
ghosts = new Group(); 
asteroids = new Group();
for(var i=0; i<8; i++)
var ang = random(360);
var px = width/2 + 1000 * cos(radians(ang));
var py = height/2 + 1000 * sin(radians(ang));
createAsteroid(3, px, py);
//var lightning = createImg("assets/lightning.gif")
//image(lightning, 0, 0);
// image(bird_loadimg, 0, 0, 309, 156); //loads only first frame
// bird_createimg.position(50,100); //loads GIF correctly

function draw() 


for(var i=0; i<allSprites.length; i++)
var s = allSprites[i];
if(s.position.x < -MARGIN) s.position.x = width + MARGIN;
if(s.position.x > width+MARGIN) s.position.x = -MARGIN;
if(s.position.y < -MARGIN) s.position.y = height + MARGIN;
if(s.position.y > height+MARGIN) s.position.y = -MARGIN;


function createAsteroid(type, x, y)
var a = createSprite(x,y);
var img = loadImage("assets/asteroid" + floor(random(0,3)) + ".png");
a.rotatingSpeed = 0.5;
a.type = type;
a.mass = 2 + a.scale;
return a;

function keyPressed() 
if (keyCode == UP_ARROW && ghostCount < 4) 
var ghost = createSprite(body.position.x+xPos, body.position.y+yPos);
xPos = xPos + 70;
yPos = yPos + 40;

var bird_loadimg, bird_createimg;
function preload()
song = loadSound("assets/thundersound.mp3");