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