Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions AsteroidsGame.pde
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
//your variable declarations here
public void setup()
Spaceship bob;
Star s[] = new Star[200];

public void setup()
{
//your code here
size(500, 500);
bob = new Spaceship();
for (int i = 0; i < 200; i++) {
s[i] = new Star();
}
}
public void draw()
public void draw()
{
background(0);
for (int i = 0; i < 200; i++) {
s[i].show();
}
}
public void keyPressed()
{
//your code here
if ( key == 'q' || key == 'Q') {
bob.setX((int)(Math.random()*width));
bob.setY((int)(Math.random()*height));
bob.myXspeed = 0;
bob.myYspeed = 0;
bob.setPointDirection((int)(Math.random()*36)*10);
background(0);
}
}