Andy Li's Blog

Blog on haXe, Flash/Flex, web development, design, media art, and my personal life.
  • Home
  • About

My first Processing work – BulletHell

October 31st, 2008  |  Published in Uncategorized

Here is my first Processing work, shown to you by the mighty processing.js.
It can’t be shown on IE.
Read the rest of this entry »

Here is my first Processing work, shown to you by the mighty processing.js. It can't be shown on IE. Source code: float[][] rocks = new float[50][4]; float[] ship = new float[2]; int lifetime = 0; int gameStatus = 1; //0:playing, 1:pause, 2:end int[] keyIsDown = new int[4]; //up, right, down, left float addSpeed = 0; PFont font; void setup(){ size(480,320); frameRate(30); smooth(); noStroke(); font = loadFont("Serif-48.vlw"); init_var(); //display instruction background(150); textFont(font, 22); text("Press r to start/restart", 10, height/2 - 30); text("Use your mouse to move", 10, height/2); text("Press P pause", 10, height/2 + 30); } void draw(){ if (gameStatus == 0){ background(0); lifetime++; //move ship ship[0]+=(mouseX-ship[0])*0.3; ship[1]+=(mouseY-ship[1])*0.3; ellipse(ship[0],ship[1],20,20); if (lifetime < 10000){ addSpeed = lifetime; addSpeed = addSpeed/1000 +1; }
Tags: Processing
©2010 Andy Li's Blog
Powered by WordPress using Blueprint.