Recent Posts
None | 1 sec ago
Lua | 2 sec ago
None | 20 sec ago
Lua | 24 sec ago
C++ | 26 sec ago
None | 28 sec ago
PHP | 35 sec ago
None | 50 sec ago
C | 51 sec ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Spoon on the 10th of Feb 2010 12:16:51 AM Download | Raw | Embed | Report
  1. Alien aliens[];
  2. Player player;
  3.  
  4.  
  5. PImage invader, explode;
  6. void setup() {
  7.   size(SCREENX, SCREENY);
  8.   invader = loadImage ("invader.GIF");
  9.   explode = loadImage ("exploding.GIF");
  10.   aliens = new Alien[10];
  11.   init_aliens(aliens, invader, explode);
  12.   player = new Player(350);
  13.   frameRate = 5;
  14. }
  15.  
  16. void init_aliens(Alien baddies[], PImage okImg, PImage exImg){
  17.   for(int i=0; i<aliens.length; i++){
  18.       baddies[i] = new Alien(i*(okImg.width+GAP), 0, okImg, exImg);
  19.   }
  20. }
  21. void draw(){
  22.   print (player.xposish);
  23.   player.move(mouseX);
  24.   player.draw();
  25.   background(0);
  26.   move_array(aliens);
  27.   draw_array(aliens);
  28. }
  29.  
  30.  
  31. void draw_array(Alien aliens[]){
  32.   for(int i=0; i<aliens.length; i++)  
  33.     aliens[i].draw();
  34. }
  35.  
  36.  
  37. void move_array(Alien aliens[]){
  38.   for(int i=0; i<aliens.length; i++)
  39.     aliens[i].move();
  40. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: