Tumgik
Video
Me playing the game
Final Project Documentation:
This is a video from when we presented our project at the NYU Computer Science Spring 2014 Project Showcase. Our project was pretty well received by the people there. One recommendation for future exploration is the use of pattern detection to detect pattens that make up people’s faces/hands/etc.
4 notes · View notes
Video
Final Project Documentation:
So this is a video demonstrating our game in progress. Here, Leor clicked on her mouth that she saw on the webcam and the game started following the colored pixels that made up her mouth. You can see that the little minion player object followed around her mouth as she moved her head around in the view of the webcam. As the player object got hit by the cannonballs, you lost health (shown by the red bar at the top), while picking up the bananas increased your health and gave you  score points. After death, the game shows a game over screen showing the current round’s score and time spent alive along with the top score and the longest amount of time spent alive since the program was started.
2 notes · View notes
Photo
This can be run on Jonathan's laptop.
Tumblr media Tumblr media
Final Project Documentation:
Here we have the arduino circuitry that I made for the game.
2 notes · View notes
Photo
wo w
Tumblr media Tumblr media
1M notes · View notes
Video
CS department showcase: people playing the game (our final project) with a green marker. Seems like she is having fun!
2 notes · View notes
Text
Peer Evaluation Re-do (Individual)
I emailed the prof and learned that we are not suppose to do peer evaluation together in a group. Here is my personal one. 
In the order of the email sent to class mailing list:
1: Laser Pool
I think it's a cool project and can be very educational for children about light reflections. However, the setup is similar to their midterm projects. It's still very hard to hit the target. And I feel that they can improve more. For example, when the program runs, have the program run a sound file that explains "hit the green target first with the laser!" 
With sound instructions and background sound, the game would be less stressful. 
2. Whitney and Michael
I think going from music instrument to wearable electronics is fantastic in the sense of trying out new things and explore new territories. The device is very easy to use. It tracks the amount of walking a person does and gives a healthy incentive for the person to walk more. It can be easily adopted to people riding a biking and having LED light up the progress on the handle.
And to further the project, they can make it send out a tweet every time the person completes the target walking distance. That needs a wireless board. But this is just a suggestion.
3. Holi Fest
I think creating artworks through this machine is very fun. Watching it is also very fun. I think to further this, they can maybe do more interaction by making the machine control some of the buttons. For example, the LEDs that light up can produce a math problem for a child, if the child gets it right and click the button for x number of times, the fans start to blow. It's like a reward.
4. interactive doll
I think recording custom sounds and more interactions in each body part would make this project so fun! I don't have suggestions that this moment.
5. Hamza and Kevin
I think accelerometer is very sensitive. It seems like they want to detect movement only in the x direction. Can't wait to see the actual implementation. I think we do have code that can benefit them. Because our game has a bouncing obstacles component. 
6. The Apollo
It's a very cool idea. I think possible jittering would be a problem for this project. But it's very interesting to both adults and children. 
7. Tic-Tac-Toe
Only one downside is I wouldn't know what to do with the game without explanations from the maker. The glove seems can be more stable if those two bending resistor can be covered with another layer of cloth. It's very cool, however the interaction is somewhat limited. 
8. interactive voodoo doll
It's very unique and cutely designed. The white cloth cleverly covers all the wires. The interactions are fun (sort of). Because we know we are not actually torturing anyone. I think the servo motors are similar to our shy flower project. we can somewhat help them in that aspect.
9. Heart-rate monitor
I think it's a very practical project. And it can produce a lot of meaningful data. Maybe add more interactions besides only tracking heart rate. Maybe it does something fun when your heart rate is racing within the normal ranges. 
0 notes
Video
Project explanation part two
2 notes · View notes
Video
project explanation part ONE : Need to watch part two for complete demo
2 notes · View notes
Text
Final Project Processing Code - Minion Dodgeball
// in order to run this code, you will need three images and a mp3 file
// and download minim library 
import processing.video.*; import ddf.minim.*;
int curPlayerSizeX = 0; int curPlayerLocX = 0; int curPlayerLocY = 0; boolean collision = false; boolean gameLose = false; player player1 = new player(); ball[] balls = new ball[5]; healing healBall = new healing(); int hp = 700; int score = 0; int highScore = 0; boolean healCollision = false; int actualSecs = 0; //actual seconds elapsed since start int actualMins; //actual minutes elapsed since start int startSec = 0; //used to reset seconds shown on screen to 0 int holdSec = 0; int maxSec = 0; int scrnSecs; //seconds displayed on screen (will be 0-60) int restartSecs=0; //number of seconds elapsed at last click or 60 sec interval int framerate = 40; double secondsCounter = 0; PImage character; PImage health; PImage bomb; // Variable for capture device Capture video; // A variable for the color we are searching for. color trackColor; String soundname; AudioSnippet background_sound; Minim minim; void setup() { //sound minim = new Minim(this); soundname = "dm.mp3"; frameRate(framerate); size(640, 480); String[] cameras = Capture.list(); if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); } else { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) { println(cameras[i]); } // The camera can be initialized directly using an // element from the array returned by list(): video = new Capture(this, cameras[0]); video.start(); } // Start off tracking for green trackColor = color(0,255,0); smooth(); for (int i=0; i<5; i++) { //Creates 5 balls balls[i] = new ball(); } for (int j = 0; j<5; j++) { //Sets random starting locations for the balls balls[j].setXloc(); balls[j].setYloc(); balls[j].setXdir(); balls[j].setYdir(); } healBall.setLocX(); healBall.setLocY(); character = loadImage("character.png"); health = loadImage("health.png"); bomb = loadImage("bomb.png"); // sound background_sound = minim.loadSnippet(soundname); background_sound.play();
}
void draw() { if (!background_sound.isPlaying()) { // The ring() function plays the sound, as long as it is not already playing. // rewind() ensures the sound starts from the beginning. background_sound.rewind(); background_sound.play(); } // Capture and display the video if (video.available()) { video.read(); } video.loadPixels(); imageMode(CORNER); image(video,0,0);
// Before we begin searching, the "world record" for closest color is set to a high number that is easy for the first pixel to beat. float worldRecord = 500;
// XY coordinate of closest color int closestX = 0; int closestY = 0;
// Begin loop to walk through every pixel for (int x = 0; x < video.width; x ++ ) { for (int y = 0; y < video.height; y ++ ) { int loc = x + y*video.width; // What is current color color currentColor = video.pixels[loc]; float r1 = red(currentColor); float g1 = green(currentColor); float b1 = blue(currentColor); float r2 = red(trackColor); float g2 = green(trackColor); float b2 = blue(trackColor);
// Using euclidean distance to compare colors float d = dist(r1,g1,b1,r2,g2,b2); // We are using the dist( ) function to compare the current color with the color we are tracking.
// If current color is more similar to tracked color than // closest color, save current location and current difference if (d < worldRecord) { worldRecord = d; closestX = x; closestY = y; } } }
// We only consider the color found if its color distance is less than 10. // This threshold of 10 is arbitrary and you can adjust this number depending on how accurate you require the tracking to be. if (worldRecord < 100) { // Put the character at the tracked pixel imageMode(CENTER); image (character, closestX, closestY); player1.setXLoc(closestX); player1.setYLoc(closestY); } textSize(12); if (gameLose == false){ for (int i=0; i<5; i++){ curPlayerSizeX = player1.xSizeGet(); curPlayerLocX = player1.xLocGet(); curPlayerLocY = player1.yLocGet(); collision = balls[i].checkCollision(curPlayerSizeX, curPlayerLocX, curPlayerLocY); healCollision = healBall.checkCollision(curPlayerSizeX, curPlayerLocX, curPlayerLocY); if (collision == true){ hp = hp-10; } else if (healCollision == true) { healBall.setLocX(); healBall.setLocY(); score++; if (hp <= 700-healBall.healingGet()) { hp = hp + healBall.healingGet(); } healCollision = false; } else { //If the player did not hit a ball, then the game continues playing for (int l=0; l<5; l++){ balls[l].move(); //Uses the ball's method to move the ball }
for (int j=0; j<5; j++){ //Draws the balls fill(175, 23, 23); imageMode(CENTER); image(bomb, balls[j].xLocGet(),balls[j].yLocGet()); } for (int h=0; h<5; h++){ //Bounces the balls off the walls balls[h].bounce(480, 640); }
imageMode(CENTER); image(character, player1.xLocGet(),player1.yLocGet()); //draws character image(health, healBall.xLocGet(),healBall.yLocGet());//draws bananas } } // print clock secondsCounter += 1D/framerate; //add to seconds counter println(secondsCounter); fill(0); textSize(20); text(nf((int) secondsCounter, 2) +" seconds", 10, 470); // end of clock } fill(255,0,0); rect(10,10,hp,10); if (hp <= 0) { gameLose = true; } fill(0); text(hp, 20, 20, 0); text("score: "+score, 10, 450, 0); if (gameLose == true){ //When the game is lost, it goes and prints the game over screen background(0); fill(255); textAlign(CENTER); if (score > highScore) { highScore = score; } textSize(70); text ("YOU DIED \n", width/2, 300, 0); textSize(15); text ("Your Score: " + score + " High Score: " + highScore + "\n Press any key to play again! \n", width/2, 400, 0); final double setTime = secondsCounter; holdSec = (int)setTime; if (holdSec > maxSec) { maxSec = holdSec; } text ("You Lived: " + holdSec + " Seconds \n Longest Time Lived: " + maxSec + " Seconds", width/2, 450, 0); }
}
void mousePressed() { // Save color where the mouse is clicked in trackColor variable int loc = mouseX + mouseY*video.width; trackColor = video.pixels[loc]; }
//BALL OBJECT------------------------------------------------------------------//
class ball {
int xBallSize, yBallSize, xBallLoc, yBallLoc, xBallDir, yBallDir, ballRadius; ball(){ xBallSize = 40; yBallSize = 40; xBallDir = 1; yBallDir = 1; xBallLoc = 20; yBallLoc = 50; ballRadius = xBallSize/2; }
//Methods to get the various attributes of the ball object into the main int xSizeGet(){ return xBallSize; } int ySizeGet(){ return yBallSize; } int xDirGet(){ return xBallDir; } int yDirGet(){ return yBallDir; } int xLocGet(){ return xBallLoc; } int yLocGet(){ return yBallLoc; } //Methods to set various aspects of the ball object depending on what the main wants it to do int setXloc(){ return xBallLoc = (int) (Math.random()*500+1); } double setYloc(){ return yBallLoc = (int) (Math.random()*500+1); } double setXdir(){ //Random mult by 1 or -1 to set x direction --> how to generate only either one of those? return xBallDir; } double setYdir(){ //Random mult by 1 or -1 to set a y direction return yBallDir; } //Method to move the ball object when it's being animated, shifts the x & y locations void move(){ xBallLoc += 2*xBallDir; yBallLoc += 1*yBallDir; } //Method to bounce the ball off of the walls void bounce(int NROWS, int NCOLS){ if ((xBallLoc+(xBallSize/2) >= NCOLS)){ //If it hits the right wall, it bounces off towards the left xBallDir = -1; } if ((xBallLoc <= (xBallSize/2))){ //If it hits the left wall, it bounces off to the right xBallDir = 1; } if ((yBallLoc+(yBallSize/2) >= NROWS)){ yBallDir = -1; } if ((yBallLoc <= (yBallSize/2))){ yBallDir = 1; } } boolean checkCollision(int curPlayerSizeX,int curPlayerLocX,int curPlayerLocY) { boolean collision = false; int playerRadius = curPlayerSizeX/2; float xDiff = xBallLoc - curPlayerLocX; float yDiff = yBallLoc - curPlayerLocY; float dist = (float) Math.sqrt((xDiff*xDiff) + (yDiff*yDiff)); if (ballRadius+playerRadius > dist){ collision = true; } return collision; } //Method to get the ball's distance from the player object float getDist(float curPlayerLocX, float curPlayerLocY){ float xDiff = xBallLoc - curPlayerLocX; float yDiff = yBallLoc - curPlayerLocY; float dist = (float) Math.sqrt((xDiff*xDiff) + (yDiff*yDiff)); return dist; } }
//PLAYER OBJECT------------------------------------------------------------------//
class player { int xPlaySize, yPlaySize, xPlayDir, yPlayDir, xPlayLoc, yPlayLoc, moveDist; //All private because...private is always nice! player(){ xPlaySize = 40; yPlaySize = 40; xPlayDir = 1; yPlayDir = 1; xPlayLoc = 100; yPlayLoc = 100; moveDist = 2; } //Methods to get the various attributes of the player object int xSizeGet(){ return xPlaySize; } int ySizeGet(){ return yPlaySize; } int xDirGet(){ return xPlayDir; } int yDirGet(){ return yPlayDir; } int xLocGet(){ return xPlayLoc; } int yLocGet(){ return yPlayLoc; } //Sets the location of the player to where the mouse cursor is void setXLoc(int mouseX){ xPlayLoc = mouseX; } void setYLoc(int mouseY){ yPlayLoc = mouseY; } }
//HEALING BALL OBJECT---------------------------------//
class healing {
int xDir, yDir, xLoc, yLoc, xSize, ySize, ballRadius, healing; healing(){ xDir = 1; yDir = 1; xLoc = 20; yLoc = 50; xSize = 40; ySize = 40; ballRadius = xSize/2; healing = 20; } int xDirGet(){ return xDir; } int yDirGet(){ return yDir; } int xLocGet(){ return xLoc; } int yLocGet(){ return yLoc; } int xSizeGet(){ return xSize; } int ySizeGet(){ return ySize; } int ballRadiusGet(){ return ballRadius; } int healingGet() { return healing; } //Methods to set various aspects of the ball object depending on what the main wants it to do double setLocX(){ return xLoc = (int) (Math.random()*400+1); } double setLocY(){ return yLoc = (int) (Math.random()*400+1); }
boolean checkCollision(int curPlayerSizeX,int curPlayerLocX,int curPlayerLocY) { boolean collision = false; int playerRadius = curPlayerSizeX/2; float xDiff = xLoc - curPlayerLocX; float yDiff = yLoc - curPlayerLocY; float dist = (float) Math.sqrt((xDiff*xDiff) + (yDiff*yDiff)); if (ballRadius+playerRadius > dist) { collision = true; } return collision; } //Method to get the ball's distance from the player object float getDist(float curPlayerLocX, float curPlayerLocY) { float xDiff = xLoc - curPlayerLocX; float yDiff = yLoc - curPlayerLocY; float dist = (float) Math.sqrt((xDiff*xDiff) + (yDiff*yDiff)); return dist; }
}
void keyPressed() { //If the person presses any key... secondsCounter = 0; actualSecs = (millis() / 1000); println("Changing actualSecs to " + actualSecs); gameLose = false; //...the lose state is reversed so the game can be played again for (int j = 0; j<5; j++) { //Because we're playing the game again, we need to reset the ball locations balls[j].setXloc(); balls[j].setYloc(); balls[j].setXdir(); balls[j].setYdir(); } hp = 700; score = 0; }
4 notes · View notes
Video
Timer: displays how long you have lasted since the beginning of the game. 
Final Project Documentation:
Here, we got the time working working off of the framerate with some help from Professor Bloomberg during class on 05/07. The current in game time is shown right below the healthbar and score counter, and the death screen now shows the total amount of time the player was alive that round and the longest amount of time the player lived in a round since starting the program.
2 notes · View notes
Video
Final Project Documentation:
Here we got the healing and score ball working. The ball appears randomly on the screen, and when you collide into it you get 20 health (shown by health bar getting longer) and you +1 to your score. The score is tallied and now has a part at the death screen showing how much you scored that round and your high score overall since starting the program.
3 notes · View notes
Video
Final Project Documentation:
Here we got the health bar working with the game. You start with 700 health, which goes down by 20 each time you get hit by a ball. You can see the red health bar go down along with the health number until death.
2 notes · View notes
Video
Final Project Documentation:
Here I finally got the java that I coded previously to work properly with the processing program.
2 notes · View notes
Video
Final Project Documentation:
Here is the game that we used as the base for the project. I created this out of an old java project that I had lying around. It just has to be converted to work properly with processing.
3 notes · View notes
Link
we did this together. I forgot to reblog the day we posted this on Leor's blog. 
Laser Pool
Possible things to share: n/a
Interactions: Puzzle-solving, reflecting a laser around. These interactions seem intuitive, because they play into the pop-cultural trope often used in spy movies of lasers bouncing around and criss-crossing a room. People have that idea in their head of...
2 notes · View notes
Text
Final Project Idea and Description
Our idea is to create a game in which you can control a character on a computer screen physically and the objective is to dodge other bouncing objects while trying to pick up fruit to gain score.
We would like to use camera to capture the user movement and make the character on screen correspond to the user movement.  In another word, you are holding a ball and by moving the ball upward, the character on screen moves upward and you need to dodge bouncing objects.
The player has a health bar that decreases whenever they get hit by a bouncing object, and increases when they pick up fruit. The player object will be controlled by motion detection from a laptop webcam tracking a ball or toy that we hold. We then move the toy up/down/left/right in order to move the object on the screen accordingly. We also intend to install an accelerometer onto the ball/toy so that it can detect tilt. When we tilt the ball/toy, the object on the screen will shrink for a short period of time but at the cost of slowly decreasing health. A button will also be installed onto the ball/toy so that the user can start/stop the game as needed. If we have the time to code it in, we also intend to add the function of having the object on the screen only pick up the fruit if a button on the toy/ball is pressed, resulting in more interaction between the player and machine/game.
Target audience: Kids, college students, casual gamers, bored people, fans of the game characters
Does it solve an existing need?: The need to have fun. For young children, it trains their hand-eye coordination and motor skills
-Does it enhance an existing interaction or human behavior
               -Relaxation and entertainment
               -Interaction with virtual objects via physical motion
-Parts needed, cost of parts, when they arrive
               -Camera (cost 0, comes with laptop)
               -Come sort of green ball/object (cost at most around $5, can get within a 2-5 days at most)
               -Potential items:
                       -Accelerometer (cost ~$15, around a week to arrive)
                       -Button (cost 0, came with class Arduino kits)
-What hardware/mechanical devices/movements are included?
               -Physical motion of moving the object in front of the character, detected via the laptop camera
               -Possible hardware attached to the object:
               -Accelerometer: Twist left and right to do some sort of game function (e.g. chance the size of character on screen)
                -Buttons: To start/stop the game or to add more game functions
-What Arduino/Processing/software applications or libraries used?
               -Video processing library and blob detection library (for camera)
               -Processing library for detecting Arduino input and creating the game
-Group Members: 
                -Leor Freedman: Sophomore, Gallatin, Majoring in ComSci & Performing Arts, good at building & designing things, working on graphics and camera
                 -Angela Pan: Junior, CAS, Majoring in ComSci, good at coding & software dev, working on the game and it’s interface
                  -Jonathan Chua: Sophomore, CAS, Majoring in Psychology, good at hardware & game creation, working on the physical hardware and game 
0 notes
Photo
Tumblr media Tumblr media Tumblr media
I noticed images are very small in previous three posts. I'm re-uploading the images. For detailed descriptions of each lab, refer to previous posts. And there is one video demo of assignment 3(real time data visualization). 
0 notes