# Three Challenges by Paulin and Nick

The first challenge that we mentioned was to create a user experience that allows people to feel like their iron man. In order to beat this challenge the first step that we took was using a Kinect to detect the hand of a user and to detect whether this hand moves in the X, Y or Z axis. This weekend we learned how the infrared sensor of the Kinect works and how it can detect the distance of objects.  So we created a processing program that detects the hand of the user when it’s in a specific distance and it puts an ellipse in the middle of the hand and then if the user moves his hand closer than the code change the color of the ellipse simulating that the user shot at a target. The code is attached.

```import org.openkinect.freenect.*;
import org.openkinect.freenect2.*;
import org.openkinect.processing.*;
import org.openkinect.tests.*;
PImage img;

Kinect kinect;

void setup(){
size(512,484);
kinect = new kinect(this);
kinect. initDepth();
kinect.initDevice();
img = createImage(kinect.depthWidth, kinect.depthHeight,RGB);
}

void draw(){
background(0);

int[] depth = kinect.getRawDepth();
float sumX = 0;
float sumY = 0;
float totalPixels = 0;
for (int x = 0; x<kinect.depthWidth; x++){
for (int y =0; y< kinect.Height; y++){
int offset = x + y*kinect.depthWidth;
int d = depth[offset];
if(d>400 && d<1000){
img.pixels[offset] = color(255,0,150);
sumX+= x;
sumY+=y;
totalPixels++;
}
else if(d>200 && d<400){
img.pixels[offset] = color(128,255,0);
sumX+= x;
sumY+=y;
totalPixels++;
}
else;
img.pixels[offset] = color(0);
}
}
img.updatePixels();
image(img,0,0);

float avgX = sumX/totalPixels;
float avgY =sumY/totalPixels;
fill(150,0,255);
ellipse(avgX,avgY,64,64);
}```

Credits to Daniel Shiffman from the Coding Train to teach us how to read kinect data

Our second obstacle was to create a glove that would represent one that would be identical to Iron Man’s. When we searched on Google, we found out that a replica of Iron Man’s glove was around 300 dirhams, but we realized we can still make something similar without paying that much. If we find a red glove and put metal ornaments and be careful with our design, we can achieve the similar glove and it’s also fine since we will be using kinetic glove movement. This means that the kinetic camera will only detect the hand rather than any light or design-related issues from the glove. Therefore, we can put more effort into making the glove as similar as possible.
Finally, our last challenge was to make the game more video-gameish in the sense that the game will be more interactive than just hitting the play button and playing the game. What we have come up, for more interactive play, is the function that allows users to write their names once they play the game and see who is on the top of the scoreboard. Not only that, we are also thinking of putting in an option button at the start of the game that will have controls to determine how fast the targets will appear, etc. Hopefully these updates will allow the player to have more freedom and thus have a better experience with our upcoming game.