Created
December 15, 2013 21:45
-
-
Save digulla/7978610 to your computer and use it in GitHub Desktop.
Writing Games with Processing: Setup and a Simple Player Character
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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