Tuesday, 17 January 2012

17/01/12

Today I managed to complete my final prototype with complete working mini game. My teacher helped me to find the correct area into which to place my score codes for my variables that allowed a score to be determined based on how many eggs are in the right basket- and we found that we were required to put my coding on the same frame in which my frame duration was set, making the final code as followed:
var duration:Number = 64000;
var yourInterval:Number = setInterval(doSomething, duration);

function doSomething():Void
{
    if (red1.hitTest(redbasket)) {
  score+=1;
 }
  if (red2.hitTest(redbasket)) {
  score+=1;
 }
  if (red3.hitTest(redbasket)) {
  score+=1;
 }
  if (red4.hitTest(redbasket)) {
  score+=1;
 }
  if (blue1.hitTest(bluebasket)) {
  score+=1;
 }
 if (blue2.hitTest(bluebasket)) {
  score+=1;
 }
 if (blue3.hitTest(bluebasket)) {
  score+=1;
 }
 if (blue4.hitTest(bluebasket)) {
  score+=1;
 }
 if (orange1.hitTest(orangebasket)) {
  score+=1;
 }
 if (orange2.hitTest(orangebasket)) {
  score+=1;
 }
 if (orange3.hitTest(orangebasket)) {
  score+=1;
 }
 if (orange4.hitTest(orangebasket)) {
  score+=1;
 }
 if (green1.hitTest(greenbasket)) {
  score+=1;
 }
 if (green2.hitTest(greenbasket)) {
  score+=1;
 }
 if (green3.hitTest(greenbasket)) {
  score+=1;
 }
 if (green4.hitTest(greenbasket)) {
  score+=1;
 }
 gotoAndPlay("Score Page", 1);
    clearInterval(yourInterval);
    
}

No comments:

Post a Comment