Skip to content

Instantly share code, notes, and snippets.

@digulla
Created December 15, 2013 21:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save digulla/7978610 to your computer and use it in GitHub Desktop.
Writing Games with Processing: Setup and a Simple Player Character
// Version 1: Setup and a Simple Player Character
void setup() {
size(640, 480); //VGA for those old enough to remember
}
int px = 320, py = 240;
int tileSize = 20;
void drawPlatty() {
fill(235,220,160);
rect(px, py, tileSize, tileSize);
fill(0);
textSize(tileSize-2);
textAlign(CENTER, CENTER);
text("P", px+tileSize/2, py+tileSize/2-2);
}
void drawBackground() {
fill(174, 204, 27); // green
rect(0, 0, width, height); // fill whole screen
}
void draw() {
drawBackground();
drawPlatty();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment