Thursday, April 16, 2009

My Part of the FinAL Thing


http://www.youtube.com/watch?v=WTMWZmzHn6w Doc VIDEO

The Flash part of HAND IT was created to take in the data sent by MAXMSP and manipulate that data to work with the interface. MAXMSP sends the two colors tracked as “xyxy” strings in an XML. The first xy is first color being track. The second xy is the second color being tracked. The two colors we used are red and blue because they are the most stable colors. In the Flash, we have created many objects for the game. There were the gates, the notes, the hands and the scoring system. The hands are controlled by the xyxy data sent from MAXMSP. The gates are used to increase the score of the player. They exist in the four corners of the interface. Notes shoot from the middle to one of the corners of the interface to match the beat of the game. Gates become active when the hand is hovering on the gate. When a note passes over the gates, by activating the gate while the note is over, the score will increase. The score determines the final result of that the user will receive. If the score was less than 900, then the user will receive a fail screen. If the score were between 900 and 1200, the user will get a RANK B ending. If the user miraculously scores over 1200 points, then the RANK A ending will appear showing the magnificent universe that he or she has created. Most of the flash were done in if statements, and for constant updating they were all done using enterFrame events. We used actionScript 2.0 because that’s how FLOSC (Flash Open Sound Control) was written in. Originally the entire game was already written in actionScript 3.0, but because we were unable to rewrite FLOSC, we were forced to translate it to actionscript 2.0. The Flash part that linked to MAX MSP was to receive the data, identify how the xyxy were sent, break it down into individual x and y integers to synchronize the hand.


CODE:


For score detection:

stageMC.onEnterFrame = function() {

//TOPLEFT SCORE CHECK
if ((HANDL._x > 60 && HANDL._x <> 50 && HANDL._y <> 60 && HANDR._x <> 50 && HANDR._y < 130)) {
hitS.gotoAndStop(2);
if (s1._x > 60 && s1._x<140) {

pointS += 1;
ScoreS.text = pointS;
}

if (s2._x > 60 && s2._x<140) {

pointS += 1;
ScoreS.text = pointS;
}
} else {
hitS.gotoAndStop(1);
}
//TOPRIGHT SCORECHECK
if ((HANDL._x > 500 && HANDL._x <> 50 && HANDL._y <> 500 && HANDR._x <> 50 && HANDR._y < 130)) {
hitP.gotoAndStop(2);
if (s3._x > 500 && s3._x < 580) {

pointP += 1;
ScoreP.text = pointP;
}

if (s4._x > 500 && s4._x < 580) {

pointP += 1;
ScoreP.text = pointP;
}
} else {
hitP.gotoAndStop(1);
}

//BOTTOMLEFT SCORECHECK
if ((HANDL._x > 60 && HANDL._x <> 350 && HANDL._y <> 60 && HANDR._x <> 350 && HANDR._y < 430)) {
hitM.gotoAndStop(2);
if (s5._x > 60 && s5._x<140) {

pointM += 1;
ScoreM.text = pointM;
}

if (s6._x > 60 && s6._x<140) {

pointM += 1;
ScoreM.text = pointM;
}
} else {
hitM.gotoAndStop(1);
}

//BOTTOMRIGHT SCORECHECK
if ((HANDL._x > 500 && HANDL._x <> 350 && HANDL._y <> 500 && HANDR._x <> 350 && HANDR._y < 430)) {
hitO.gotoAndStop(2);
if (s7._x > 500 && s7._x < 580) {

pointO += 1;
ScoreO.text = pointO;
}

if (s8._x > 500 && s8._x < 580) {

pointO += 1;
ScoreO.text = pointO;
}
} else {
hitO.gotoAndStop(1);

}

};


CODE for Shooting STUFF to the corners


//FUNCTION TO SHOOT THE STARS to the CORNERS.
function topLeft1() {
var Tx1:Tween = new Tween(s1, "_x", None.easeIn, Stage.width/2, 0, 2, true);
var Ty1:Tween = new Tween(s1, "_y", None.easeIn, Stage.height/2, 0, 2, true);
}

function topLeft2() {
var Tx1:Tween = new Tween(s2, "_x", None.easeIn, Stage.width/2, 0, 2, true);
var Ty1:Tween = new Tween(s2, "_y", None.easeIn, Stage.height/2, 0, 2, true);
}

function topRight1() {
var Tx1:Tween = new Tween(s3, "_x", None.easeIn, Stage.width/2, 640, 2, true);
var Ty1:Tween = new Tween(s3, "_y", None.easeIn, Stage.height/2, 0, 2, true);
}

function topRight2() {
var Tx1:Tween = new Tween(s4, "_x", None.easeIn, Stage.width/2, 640, 2, true);
var Ty1:Tween = new Tween(s4, "_y", None.easeIn, Stage.height/2, 0, 2, true);
}

function bottomLeft1() {
var Tx1:Tween = new Tween(s5, "_x", None.easeIn, Stage.width/2, 0, 2, true);
var Ty1:Tween = new Tween(s5, "_y", None.easeIn, Stage.height/2, 480, 2, true);
}

function bottomLeft2() {
var Tx1:Tween = new Tween(s6, "_x", None.easeIn, Stage.width/2, 0, 2, true);
var Ty1:Tween = new Tween(s6, "_y", None.easeIn, Stage.height/2, 480, 2, true);
}

function bottomRight1() {
var Tx1:Tween = new Tween(s7, "_x", None.easeIn, Stage.width/2, 640, 2, true);
var Ty1:Tween = new Tween(s7, "_y", None.easeIn, Stage.height/2, 480, 2, true);
}

function bottomRight2() {
var Tx1:Tween = new Tween(s8, "_x", None.easeIn, Stage.width/2, 640, 2, true);
var Ty1:Tween = new Tween(s8, "_y", None.easeIn, Stage.height/2, 480, 2, true);
}

topRight2();
bottomRight1();
bottomLeft2();

//FUNCTIONS THAT MOVE THE HANDS


moveLEFT(10,10);
moveRIGHT(501,100);

//HANDL.startDrag();
//TEST PURPOSE
stageMC.onKeyDown = function() {
//topLeft1();
//var Tx1:Tween = new Tween(s7, "_x", None.easeNone, 0, 190, 3, true);

};

No comments:

Post a Comment