This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
epgy:siyp13:game [2013/08/16 19:35] ffpaladin [Student Pages] |
epgy:siyp13:game [2013/08/16 19:42] (current) ffpaladin [Student Pages] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SIYP - Video Game Design and Computer Programming ====== | ||
+ | |||
+ | |||
+ | * [[http://users.soe.ucsc.edu/~sherol/teaching/doku.php?id=dma:java13:assignment1|Web Assignment]] - if your page is not listed below, fill this form out again | ||
+ | * Research in Games | ||
+ | * [[http://processing.org]] | ||
+ | * [[http://students.digitalmediaacademy.org/lesson/javai-lesson-01-processing-primer-i/|Lesson 1]] **!!START HERE!!** | ||
+ | * [[http://students.digitalmediaacademy.org/lesson/javai-lesson-01-processing-primer-ii/|Lesson 2]] | ||
+ | * Game Basics | ||
+ | * Game Loop | ||
+ | * Physics | ||
+ | * Art | ||
+ | * Sound | ||
+ | * Mechanics | ||
+ | * [[https://dl.dropboxusercontent.com/u/3235343/Teaching/GettingStartedWithProcessing.pdf|Book]] | ||
+ | |||
+ | EXAMPLES: | ||
+ | * http://www.openprocessing.org/sketch/103348 | ||
+ | * http://www.openprocessing.org/sketch/101925 | ||
+ | * http://www.openprocessing.org/sketch/106289 | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Student Pages ===== | ||
+ | |||
+ | - http://cjh4029.wordpress.com | ||
+ | - http://mabelsun2012.wordpress.com | ||
+ | - http://vivianaywang.wordpress.com | ||
+ | - http://gloria1010.wordpress.com | ||
+ | - http://ivanashen.wordpress.com | ||
+ | - http://emily0129.wordpress.com | ||
+ | - http://emmarr515.wordpress.com/ | ||
+ | - http://billybao0920.wordpress.com | ||
+ | - http://dzq153036708.wordpress.com/ | ||
+ | - http://xmczym.wordpress.com | ||
+ | - http://robin087.wordpress.com | ||
+ | - http://tiger200303.wordpress.com | ||
+ | - http://xiexinchen12897.wordpress.com | ||
+ | - http://zzl000402.wordpress.com | ||
+ | - http://huyue1969400466.wordpress.com | ||
+ | - http://Lemuelguo.wordpress.com | ||
+ | - http://768551583qq.wordpress.com/ | ||
+ | - http://q1234512345.wordpress.com/ | ||
+ | - http://chenfang7.wordpress.com/ | ||
+ | - http://cuilangqing.wordpress.com/ | ||
+ | - http://chenghaoyu2000.wordpress.com | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Sample Code ===== | ||
+ | |||
+ | |||
+ | Draw Circle | ||
+ | <code java> | ||
+ | |||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | void draw() { //draw function loops | ||
+ | |||
+ | ellipse(20,20,20,20); | ||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | Draw 2 Colored Circles | ||
+ | |||
+ | <code java> | ||
+ | |||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | void draw() { //draw function loops | ||
+ | |||
+ | fill(255,0,0); | ||
+ | | ||
+ | ellipse(20,20,20,20); | ||
+ | |||
+ | fill(0,255,0); | ||
+ | |||
+ | ellipse(40,40,20,20); | ||
+ | |||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | mouseX and mouseY | ||
+ | |||
+ | <code java> | ||
+ | int counter; | ||
+ | |||
+ | |||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | void draw() { //draw function loops | ||
+ | |||
+ | fill(255,0,0); | ||
+ | |||
+ | ellipse(mouseX,mouseY,20,20); | ||
+ | |||
+ | fill(0,255,0); | ||
+ | |||
+ | ellipse(40,40,20,20); | ||
+ | |||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | Fix my code | ||
+ | |||
+ | <code java> | ||
+ | //Traffic Light: exercise 2 (Processing mod 1) | ||
+ | |||
+ | rectMode(CENTER); | ||
+ | ellipseMode(CENTER); | ||
+ | noStroke(); | ||
+ | |||
+ | // rectangle (traffic light backing) | ||
+ | fill(195, 195, 55); | ||
+ | rect(50,50, 50, 100); | ||
+ | |||
+ | // green light | ||
+ | fill(6, 255, 6); | ||
+ | ellipse(10, 20, 25, 25); // x pos should be 50 | ||
+ | |||
+ | // yellow light | ||
+ | fill(255, 255, 6); | ||
+ | ellipse(50, 70, 25, 25); // y pos should be 50 | ||
+ | |||
+ | // red light | ||
+ | fill(255, 6, 6); | ||
+ | ellipse(80, 100, 25, 25); //x pos should be 50, y pos should be 80 | ||
+ | noFill(); | ||
+ | </code> | ||
+ | |||
+ | Black Background | ||
+ | |||
+ | <code java> | ||
+ | |||
+ | // SECTION 1 | ||
+ | int x = 20; | ||
+ | int y = 20; | ||
+ | |||
+ | //SECTION 2 | ||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | //SECTION 3 | ||
+ | void draw() { //draw function loops | ||
+ | |||
+ | background(0); // makes it black | ||
+ | |||
+ | fill(255,0,0); | ||
+ | |||
+ | ellipse(mouseX,mouseY,20,20); | ||
+ | |||
+ | fill(0,255,0); | ||
+ | |||
+ | ellipse(40,40,20,20); | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | </code> | ||
+ | |||
+ | Falling Green Ball | ||
+ | |||
+ | <code java> | ||
+ | // SECTION 1 | ||
+ | |||
+ | int counter; | ||
+ | int x = 20; | ||
+ | int y = 20; | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | //SECTION 2 | ||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | //SECTION 3 | ||
+ | void draw() { //draw function loops | ||
+ | |||
+ | background(0); // makes it black | ||
+ | |||
+ | fill(255,0,0); | ||
+ | |||
+ | ellipse(mouseX,mouseY,20,20); | ||
+ | |||
+ | fill(0,255,0); | ||
+ | |||
+ | ellipse(x,y,20,20); | ||
+ | | ||
+ | y=y+1; | ||
+ | |||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | keypress | ||
+ | |||
+ | <code java> | ||
+ | // SECTION 1 | ||
+ | |||
+ | int counter; | ||
+ | int x = 20; | ||
+ | int y = 20; | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | //SECTION 2 | ||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | //SECTION 3 | ||
+ | void draw() { //draw function loops | ||
+ | |||
+ | background(255); // makes it black | ||
+ | |||
+ | fill(255,0,0); | ||
+ | |||
+ | ellipse(mouseX,mouseY,20,20); | ||
+ | |||
+ | fill(0,255,0); | ||
+ | |||
+ | ellipse(x,y,20,20); | ||
+ | | ||
+ | | ||
+ | |||
+ | if (key == 'd'){ | ||
+ | x = x+1; | ||
+ | } | ||
+ | | ||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | <code java> | ||
+ | |||
+ | // SECTION 1 | ||
+ | |||
+ | int counter; | ||
+ | int x = 20; | ||
+ | int y = 20; | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | //SECTION 2 | ||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 400); | ||
+ | } | ||
+ | |||
+ | |||
+ | //SECTION 3 | ||
+ | void draw() { //draw function loops | ||
+ | |||
+ | background(255); // makes it black | ||
+ | |||
+ | fill(255,0,0); | ||
+ | |||
+ | ellipse(mouseX,mouseY,20,20); | ||
+ | |||
+ | fill(0,255,0); | ||
+ | |||
+ | ellipse(x,y,20,20); | ||
+ | | ||
+ | | ||
+ | |||
+ | if (key == 'd'){ | ||
+ | x = x+1; | ||
+ | } | ||
+ | | ||
+ | if (key == 's'){ | ||
+ | y = y+1; | ||
+ | } | ||
+ | | ||
+ | if (key == 'a'){ | ||
+ | x = x-1; | ||
+ | } | ||
+ | | ||
+ | if (key == 'w'){ | ||
+ | y = y-1; | ||
+ | } | ||
+ | | ||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | 'if' color box | ||
+ | <code java> | ||
+ | |||
+ | void setup(){ | ||
+ | size(600,500); | ||
+ | background(255); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | void draw(){ | ||
+ | |||
+ | rect(50,50,50,50); | ||
+ | |||
+ | if (mousePressed){ | ||
+ | fill(255,0,0); | ||
+ | } | ||
+ | else { | ||
+ | fill(0,255,255); | ||
+ | } | ||
+ | | ||
+ | |||
+ | } | ||
+ | </code> | ||
+ | |||
+ | Bouncing Ball | ||
+ | |||
+ | <code java> | ||
+ | |||
+ | // Credit: Ren Ervin Bettendorf | ||
+ | |||
+ | /* SCREENSAVERS FER DAYS BROSKIES */ | ||
+ | |||
+ | int dx = 2; | ||
+ | int dy = 3; | ||
+ | |||
+ | int x = 50; | ||
+ | int y = 50; | ||
+ | |||
+ | void setup(){ | ||
+ | size(600,500); | ||
+ | background(0); | ||
+ | frameRate(60); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | void draw(){ | ||
+ | fill(255); | ||
+ | rect(x,y,25,25,5); | ||
+ | | ||
+ | x = x + dx; | ||
+ | y = y + dy; | ||
+ | | ||
+ | if ( x< 0 || x > 475){ | ||
+ | dx = -1 * dx; | ||
+ | } | ||
+ | | ||
+ | if ( y < 0 || y > 475){ | ||
+ | dy = -1 * dy; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | </code> | ||
+ | |||
+ | Make a Face | ||
+ | |||
+ | <code java> | ||
+ | int counter; | ||
+ | |||
+ | void setup() { //setup function called initially, only once | ||
+ | size(500, 500); | ||
+ | background(255); //set background white | ||
+ | } | ||
+ | |||
+ | void draw() { //draw function loops | ||
+ | | ||
+ | background(255); | ||
+ | | ||
+ | fill(255,255,0); | ||
+ | | ||
+ | ellipse(mouseX+50,mouseY+50,200,200); | ||
+ | | ||
+ | // eyes | ||
+ | fill(0,0,255); | ||
+ | ellipse(mouseX+75,mouseY+200,20,20); | ||
+ | ellipse(mouseX+25,mouseY+20,20,20); | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | </code> |