bio photo



I used to play Asteroids growing up. My objective is to build this game in p5. I will vary its functionality to learn weekly course objectives.


1/ Testing out the random() function by building stars that flicker in space
2/ Declaring var and objective

var pos = {
	x : 5
	y : 5

3/ Building random() sparkling stars

  //sparkling stars
  pos.x = random(0,width);
  pos.y = random(0,height);
  ellipse(pos.x, pos.y, 10, 10);

####mouseX and mouseY

1/ In the game the spaceship responds to arrow keys to rotate.
2/ Wanted to rotate the spaceship with mouseX and mouseY while it is centered. Couldn’t figure that out.
3/ Wrote the following for the spaceship (a simple triangle) to move with mouseX and mouseY

  // center space ship moves to mouse

####mouseIsPressed and firing missiles

  1. mouseIsPressed loops within draw(), unlike mousePressed(), the function which is an event
  2. Would like small ellipses to leave the tip of the triangle() on mousepressed.
  3. Need help!
  4. Instead, I get the ellpises to get circle highlights,
 if (mouseIsPressed) {


Here’s the program, and the snapshot below: