Beispiel #1
0
bool isDiscInside(Disc d,Hole h)
{
	if(isLessThan(abs(d.getX() - h.getX()),h.getRadius()) && isLessThan(abs(d.getY() - h.getY()),h.getRadius()))
		return true;
	else
		return false;
}
Beispiel #2
0
void Microphone::setHeadDepth (float d) {
	float shift = d - hD;
	hD = d;

	Hole			head	 (hD,  hR,	 cR, hR, cR, 24),
					headFront(hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, 24),
					headBack (hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, 24);
	Cone			core	 (hD * 1.43333f,  cR, cR, 24);

	head.Fly(micParts[MIC_HEAD]->getPosition().z);
	head.Strafe(-hD/2);
	head.Pitch((FLOAT)M_PI_2);
	head.Roll((FLOAT)M_PI_2);

	headFront.Fly(head.getPosition().z);
	headFront.Strafe(-head.getPosition().y);
	headFront.Pitch((FLOAT)M_PI_2);
	headFront.Roll((FLOAT)M_PI_2);

	headBack.Translate(head.getPosition());
	headBack.Pitch((FLOAT)M_PI_2);
	headBack.Roll((FLOAT)M_PI_2);

	core.Fly(head.getPosition().z);
	core.Strafe(-core.getHeight() / 2.1f);
	core.Pitch((FLOAT)M_PI_2);
	core.Roll((FLOAT)M_PI_2);

	replaceMesh(MIC_HEAD,		head);
	replaceMesh(MIC_HEAD_FRONT, headFront);
	replaceMesh(MIC_HEAD_BACK,	headBack);
	replaceMesh(MIC_CORE,		core);
}
Beispiel #3
0
std::vector<Obstacle> XMLExtractor::extractObstacles(std::string gameName, unsigned int level, Hole& hole, Point& ballPosition, float& radius)
{
	std::vector<Obstacle> obstacleArray;
	pugi::xml_document doc;

	std::string fileName = "..\\DataManager\\Courses\\" + gameName + ".xml";

	if (doc.load_file(fileName.c_str()))
	{
		std::string s = "Course" + std::to_string(level);
		pugi::xml_node obstacles = doc.child(s.c_str());
		for (pugi::xml_node obstacleNode = obstacles.first_child(); obstacleNode; obstacleNode = obstacleNode.next_sibling())
		{
			std::string obstaclestr = std::string("Obstacle").c_str();
			std::string holestr = std::string("Hole").c_str();
			std::string ballstr = std::string("Ball").c_str();
			if (obstacleNode.name() == obstaclestr)
			{
				double x = atof(obstacleNode.child_value("X"));
				double y = atof(obstacleNode.child_value("Y"));
				double width = atof(obstacleNode.child_value("Width"));
				double height = atof(obstacleNode.child_value("Height"));
				double resistance = atof(obstacleNode.child_value("Resistance"));
				double rotation = atof(obstacleNode.child_value("Rotation"));
				Obstacle obstacle(x, y, width, height);
				obstacle.setAngle(rotation);
				obstacle.setSurfaceResistance(resistance);

				//Ajouter le nouveau point au vecteur
				obstacleArray.emplace_back(obstacle);
			}
			else if (obstacleNode.name() == holestr)
			{
				hole.setPosition(atof(obstacleNode.child_value("X")), atof(obstacleNode.child_value("Y")));
				hole.setWidth(atof(obstacleNode.child_value("Width")));
				hole.setHeight(atof(obstacleNode.child_value("Height")));
			}
			else if (obstacleNode.name() == ballstr)
			{
				ballPosition = Point(atof(obstacleNode.child_value("X")), atof(obstacleNode.child_value("Y")));
				radius = atof(obstacleNode.child_value("Radius"));
			}
		}
	}
	else
	{
		std::cout << "ERREUR: Le fichier '" + fileName + "' est introuvable. \n";
	}

	return obstacleArray;
}
Beispiel #4
0
void Microphone::setHeadRadius (float r) {
	float shift = r - hR;
	hR = r; tH += shift;

	Hole			head	 (hD,  hR,	 cR, hR, cR, 24),
					headFront(hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, 24),
					headBack (hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, 24);

	head.Fly(micParts[MIC_HEAD]->getPosition().z + shift);
	head.Strafe(-hD/2);
	head.Pitch((FLOAT)M_PI_2);
	head.Roll((FLOAT)M_PI_2);
	headFront.Fly(head.getPosition().z);
	headFront.Strafe(-head.getPosition().y);
	headFront.Pitch((FLOAT)M_PI_2);
	headFront.Roll((FLOAT)M_PI_2);
	headBack.Translate(head.getPosition());
	headBack.Pitch((FLOAT)M_PI_2);
	headBack.Roll((FLOAT)M_PI_2);

	replaceMesh(MIC_HEAD, head);
	replaceMesh(MIC_HEAD_FRONT, headFront);
	replaceMesh(MIC_HEAD_BACK, headBack);

	micParts[MIC_CORE]->Translate(	micParts[MIC_CORE]->getPosition().x,
								micParts[MIC_CORE]->getPosition().y,
								micParts[MIC_CORE]->getPosition().z + shift);
	recalcMeshVertices(MIC_CORE, *micParts[MIC_CORE]);
}
int HoleCollection::Scope(const Hole &proposedHole) const
{
  const int holeStart = proposedHole.GetStart(0);
  const int holeEnd = proposedHole.GetEnd(0);
  int scope = m_scope.back();
  if (holeStart == m_sourcePhraseStart.back() ||
      find(m_sourceHoleEndPoints.begin(), m_sourceHoleEndPoints.end(), holeStart-1) != m_sourceHoleEndPoints.end()) {
    ++scope; // Adding hole would introduce choice point at start of hole.
  }
  if (holeEnd == m_sourcePhraseEnd.back() ||
      find(m_sourceHoleStartPoints.begin(), m_sourceHoleStartPoints.end(), holeEnd-1) != m_sourceHoleStartPoints.end()) {
    ++scope; // Adding hole would introduce choice point at end of hole.
  }
  return scope;
}
void StudentWorld::boulderToHole(int cur_x, int cur_y)
{
    for(unsigned int i=0; i< m_actors.size(); i++)
        if( m_actors[i]->getX()==cur_x && m_actors[i]->getY()==cur_y)
        {
            Actor* ap = m_actors[i];
            Hole* killMe = dynamic_cast<Hole*>(ap);
            if (killMe != nullptr)
            {
                killMe->setDead();
                grid[cur_x][cur_y][0]=' ';
                return;
            }
        }
    return;
}
void ProblemGenerator::saveCoordinateData(string fileName, Plate *plate) const
{
	Hole *hole = 0;

	//Open the stream
	ofstream coordinateFile(fileName.c_str(), ofstream::out);

	//Write datas
	for(Plate::Iterator iter = plate->begin(); iter != plate->end(); ++iter)
	{
		hole = (*plate)[iter];
		coordinateFile << hole->getAbscissa() << "," << hole->getOrdered() << endl;
	}

	//Close the stream
	coordinateFile.close();
}
Beispiel #8
0
void playHole(int holeName, Hole currentHole, Player jimmy, int *score )
{
    //array of things to pass from graphics to disc class
    double* stuff;   
    int scoreHole = 0 ;
    Disc disc;
    int past = 0;
    int diff;
    
    std::string currentPic;
    
     while( !disc.checkHole(currentHole.getX(), currentHole.getY()) && !past)
    {
    	currentPic = disc.pickScreen(holeName);
    	
    	//cout << currentPic << endl;
    	
    	//play the current hole
        stuff = play(currentPic, jimmy.getSong(), currentHole.getY() - disc.getY(), currentHole.getX() - disc.getX(), *score, scoreHole);
        //throw the frisbee
        disc.letFly(stuff[0],stuff[1],stuff[2],jimmy.getPower(),jimmy.getAccuracy(), currentHole);
        //track score
        (*score)++;
        scoreHole++;
        
        //see if disc has passed hole
         if(disc.getX() > currentHole.getX()) {
        	past = 1;
        	//cout << "You passed the hole. Auto score set to 8." << endl;
        	diff = 8 - scoreHole;
        	scoreHole = 8;
        	(*score) += diff;
        }
    } 
    	// determine which end screen to show
   	if( past )
		play(currentPic,jimmy.getSong(), -6, -6, *score, scoreHole);  
        else
		play(currentPic,jimmy.getSong(), 0,0, *score, scoreHole);
	
	if( holeName == 5)
		play("../../pictures/Pat_being_a_goon.png",jimmy.getSong(), -7,-7, *score, 0);
}
void GameScene::resetMole(void) {
    if (hasAvailableHole()) {
        Hole* hole = findAvailableHole();
        
        this->removeChild(hole->getSprite(), false);
        
        int randVal = random() % 100;
        if (randVal >= 0 && randVal <= 10) {
            hole->addMole("clefairy.png", CLEFAIRY);
            CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Clefairy.mp3");
        } else if (randVal >= 11 && randVal <= 20) {
            hole->addMole("dugtrio.png", DUGTRIO);
            CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("triotriotrio.mp3");
        } else if (randVal >= 21 && randVal <= 30) {
            hole->addMole("parasect.png", PARASECT);
            CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Parasect.mp3");
        } else {
            hole->addMole("diglett.png", DIGLETT);
            CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Diglett.mp3");
        }
        this->addChild(hole->getSprite());
    }
}
Beispiel #10
0
 void draw(){
     
     glPushMatrix(); // world
     glRotatef(roll, 0.0, 0.0, -1.0);
     glRotatef(pitch, 1.0, 0.0, 0.0);
     glPushMatrix(); // platform
     glScaled(width, 1, width);
     glTranslated(0, -0.5, 0);
     glColor3f(1,1,1);
     glEnable(GL_TEXTURE_2D);
     glBindTexture(GL_TEXTURE_2D, platformTexture);
     glBegin(GL_QUADS);
     glTexCoord2f(0,0);
     glVertex3f(1.0,0.5,1.0);
     glTexCoord2f(0,1);
     glVertex3f(1.0,0.5,-1.0);
     glTexCoord2f(1,0);
     glVertex3f(-1.0,0.5,-1.0);
     glTexCoord2f(1,1);
     glVertex3f(-1.0,0.5,1.0);
     glEnd();
     glBegin(GL_QUADS);
     glVertex3f(1.0,-0.5,1.0);
     glVertex3f(1.0,-0.5,-1.0);
     glVertex3f(1.0,0.5,-1.0);
     glVertex3f(1.0,0.5,1.0);
     glEnd();
     glBegin(GL_QUADS);
     glVertex3f(-1.0,-0.5,-1.0);
     glVertex3f(-1.0,-0.5,1.0);
     glVertex3f(-1.0,0.5,1.0);
     glVertex3f(-1.0,0.5,-1.0);
     glEnd();
     glBegin(GL_QUADS);
     glVertex3f(1.0,-0.5,1.0);
     glVertex3f(-1.0,-0.5,1.0);
     glVertex3f(-1.0,0.5,1.0);
     glVertex3f(1.0,0.5,1.0);
     glEnd();
     glBegin(GL_QUADS);
     glVertex3f(-1.0,-0.5,-1.0);
     glVertex3f(1.0,-0.5,-1.0);
     glVertex3f(1.0,0.5,-1.0);
     glVertex3f(-1.0,0.5,-1.0);
     glEnd();
     glBegin(GL_QUADS);
     glTexCoord2f(0,0);
     glVertex3f(1.0,-0.5,1.0);
     glTexCoord2f(0,1);
     glVertex3f(1.0,-0.5,-1.0);
     glTexCoord2f(1,0);
     glVertex3f(-1.0,-0.5,-1.0);
     glTexCoord2f(1,1);
     glVertex3f(-1.0,-0.5,1.0);
     glEnd();
     glDisable(GL_TEXTURE_2D);
     
     
     
     glPopMatrix(); // end platform
     //Maze
     
     for(int i = 0; i<26;i++){
         Block b = blocks[i];
         b.draw();
     }
     
     for(int i = 0; i<18;i++){
         Hole h = holes[i];
         h.draw();
     }
     //end MazeSides
     
     glPopMatrix(); // end world
 }
Beispiel #11
0
void MainWindow::buildHome()
{
    LinkedList<GolfObject>* list = p->getRounds(p->getId(), new Round());
    int fairwayCount = 0, greenCount = 0, sandCount =0, updownCount = 0,
            albatrossCount = 0, eagleCount = 0, birdieCount = 0, parCount = 0,
            bogeyCount = 0, dblBogeyCount = 0, trplBogeyCount = 0, quadBogeyCount = 0,
            fiveBogeyCount = 0, sixBogeyCount = 0, px = 0, pxx = 0, pxxx = 0, pxxxx = 0, pxxxxx = 0, pxxxxxx= 0;

    for(int i = 0; i < list->getSize(); i++)
    {
        Round *r = (Round *)list->get(i);
        LinkedList<GolfObject>* phList = p->getPlayedHoles(r->getId());
        for(int j = 0; j < phList->getSize(); j++)
        {
            PlayedHole *ph = (PlayedHole *)phList->get(j);
            Hole *h = new Hole();
            dbh->getHoleById(ph->getHole()->getId(), h);
            if(ph->isFairwayHit())
              fairwayCount++;
            if(ph->isGreenHit())
                greenCount++;
            if(ph->isSandSave())
                sandCount++;
            if(ph->isUpAndDown())
                updownCount++;

            int grossVal = ph->getGross() - h->getPar();
            switch(grossVal)
            {
                case -3:
                    albatrossCount++;
                    break;
                case -2:
                    eagleCount++;
                    break;
                case -1:
                    birdieCount++;
                case 0:
                    parCount++;
                    break;

                case 1:
                    bogeyCount++;
                    break;

                case 2:
                    dblBogeyCount++;
                    break;

                case 3:
                    trplBogeyCount++;
                    break;
                case 4:
                    quadBogeyCount++;
                    break;
                case 5:
                    fiveBogeyCount++;
                    break;
                case 6:
                    sixBogeyCount++;
                    break;
            }

            int puttVal = ph->getPutts();
            switch(puttVal)
            {
            case 1:
                px++;
                break;
            case 2:
                pxx++;
                break;
            case 3:
                pxxx++;
                break;
            case 4:
                pxxxx++;
                break;
            case 5:
                pxxxxx++;
                break;
            case 6:
                pxxxxxx++;
                break;
            }

        }
        delete phList;
    }


    double total = fairwayCount+greenCount+sandCount+updownCount;
    ui->statsChart->addEntry("FIR "+QString::number(((double)fairwayCount/total)*100), fairwayCount);
    ui->statsChart->addEntry("GIR "+QString::number(((double)greenCount/total)*100), greenCount);
    ui->statsChart->addEntry("Sand Save "+QString::number(((double)sandCount/total)*100), sandCount);
    ui->statsChart->addEntry("Up + Down "+QString::number(((double)updownCount/total)*100), updownCount);
    //ui->statsChart->setMaximumSize(100,100);
    ui->statsChart->show();

    total = albatrossCount+eagleCount+birdieCount+parCount+bogeyCount+dblBogeyCount+trplBogeyCount+quadBogeyCount+fiveBogeyCount+sixBogeyCount;
    ui->scores_Chart->addEntry("Albatross "+QString::number(((double)albatrossCount/total)*100), albatrossCount);
    ui->scores_Chart->addEntry("Eagle "+QString::number(((double)eagleCount/total)*100), eagleCount);
    ui->scores_Chart->addEntry("Birdie "+QString::number(((double)birdieCount/total)*100), birdieCount);
    ui->scores_Chart->addEntry("Par "+QString::number(((double)parCount/total)*100), parCount);
    ui->scores_Chart->addEntry("Bogey "+QString::number(((double)bogeyCount/total)*100), bogeyCount);
    ui->scores_Chart->addEntry("Dbl Bogey "+QString::number(((double)dblBogeyCount/total)*100), dblBogeyCount);
    ui->scores_Chart->addEntry("Trpl Bogey "+QString::number(((double)trplBogeyCount/total)*100), trplBogeyCount);
    ui->scores_Chart->addEntry("Quad Bogey "+QString::number(((double)quadBogeyCount/total)*100), quadBogeyCount);
    ui->scores_Chart->addEntry("Five Bogey "+QString::number(((double)fiveBogeyCount/total)*100), fiveBogeyCount);
    ui->scores_Chart->addEntry("Six Bogey "+QString::number(((double)sixBogeyCount/total)*100), sixBogeyCount);
    //ui->scores_Chart->setMaximumSize(100,100);
    ui->scores_Chart->show();

    ui->putts_Chart->addEntry("1 Putts", px);
    ui->putts_Chart->addEntry("2 Putts", pxx);
    ui->putts_Chart->addEntry("3 Putts", pxxx);
    ui->putts_Chart->addEntry("4 Putts", pxxxx);
    ui->putts_Chart->addEntry("5 Putts", pxxxxx);
    ui->putts_Chart->addEntry("6 Putts", pxxxxxx);
    //ui->putts_Chart->addEntry("7 Putts", pxxxxxxx);
    ui->putts_Chart->show();
}
Beispiel #12
0
void Microphone::Triangulate() {
	vertices.clear();
	edges.clear();
	polygons.clear();

	ExCone			base(bH, bR, bR, bR * 0.824f, precision);
	Pyramid			buttonL(bH * 0.6f, bW * 0.575f, bW, bW * 0.3f, bW, -bW * 0.1375f),
					buttonR(bH * 0.6f, bW * 0.575f, bW, bW * 0.3f, bW, -bW * 0.1375f);
	
	Cone			shroudLow(uH * 0.21127f, uR, uR, precision),
					bridge   (uH * 0.084537f, uR * 0.66667f, uR * 0.41667f, precision),
					shroudHi (uH - uG - shroudLow.getHeight() - uH * .04f - bridge.getHeight(), uR, uR, precision),
					upright	 (uH - bridge.getHeight(), uR * 0.66667f, uR * 0.66667f, precision);

	Pyramid			handleBridgeUp	(uH * 0.09155f, uR * 0.653f, hI, uR * 0.653f, hI),
					handleBridgeDown(uH * 0.077f,   uR * 0.653f, hI, uR * 0.653f, hI),
					handle			(uH * 0.7598f,  uR * 0.792f, uR * 0.5418f, uR * 0.5418f, uR * 0.5418f, uR * 0.125f),
					handleTop		(uH * 0.05647f, uR * 0.792f, uR * 0.5418f, uR * 0.792f,  uR * 0.5418f,-uR * 0.3542f);

	Hole			head	 (hD,  hR,	 cR, hR, cR, precision),
					headFront(hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, precision),
					headBack (hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, precision);
	Cone			core	 (hD * 1.43333f,  cR, cR, precision);

	base.Yaw(-(FLOAT)M_PI_2);
	base.Transform();

	buttonL.Translate(-bR * 0.2588f, bR * 0.824f, bH * 1.1f);
	buttonL.Pitch((FLOAT)M_PI);
	buttonL.Transform();

	buttonR.Translate(bR * 0.2588f, bR * 0.824f, bH * 1.1f);
	buttonR.Pitch((FLOAT)M_PI);
	buttonR.Transform();

	upright.Fly(bH);
	upright.Transform();

	shroudLow.Fly(base.getHeight() + uH * .04f);
	shroudLow.Transform();

	shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG);
	shroudHi.Transform();

	bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight());
	bridge.Transform();

	handleBridgeUp.Fly(uH * 0.8f);
	handleBridgeUp.Follow(uR + hI / 2);
	handleBridgeUp.Transform();

	handleBridgeDown.Fly(bH + uH * 0.15f);
	handleBridgeDown.Follow(handleBridgeUp.getPosition().x);
	handleBridgeDown.Transform();

	handle.Translate(uR * 1.5f + hI, bR * 0.0059f, uH * .95f);
	handle.Pitch((FLOAT)M_PI);
	handle.Yaw((FLOAT)M_PI_2);
	handle.Transform();

	handleTop.Translate(handle.getPosition().x, handle.getPosition().y, handle.getPosition().z);
	handleTop.Yaw((FLOAT)M_PI_2);
	handleTop.Transform();

	head.Fly(bridge.getPosition().z + bridge.getHeight() + hR);
	head.Strafe(-hD/2);
	head.Pitch((FLOAT)M_PI_2);
	head.Roll((FLOAT)M_PI_2);
	head.Transform();

	headFront.Fly(head.getPosition().z);
	headFront.Strafe(-head.getPosition().y);
	headFront.Pitch((FLOAT)M_PI_2);
	headFront.Roll((FLOAT)M_PI_2);
	headFront.Transform();

	headBack.Translate(head.getPosition());
	headBack.Pitch((FLOAT)M_PI_2);
	headBack.Roll((FLOAT)M_PI_2);
	headBack.Transform();

	core.Fly(head.getPosition().z);
	core.Strafe(-core.getHeight() / 2.1f);
	core.Pitch((FLOAT)M_PI_2);
	core.Roll((FLOAT)M_PI_2);
	core.Transform();

	addMesh(MIC_BASE,		base);
	addMesh(MIC_BUTTON_L,	buttonL);
	addMesh(MIC_BUTTON_R,	buttonR);
	addMesh(MIC_UPRIGHT,	upright);
	addMesh(MIC_SHROUD_LOW,	shroudLow);
	addMesh(MIC_SHROUD_HI,	shroudHi);
	addMesh(MIC_BRIDGE,		bridge);
	addMesh(MIC_HANDLE_BU,	handleBridgeUp);
	addMesh(MIC_HANDLE_BD,	handleBridgeDown);
	addMesh(MIC_HANDLE,		handle);
	addMesh(MIC_HANDLE_TOP,	handleTop);
	addMesh(MIC_HEAD,		head);
	addMesh(MIC_HEAD_FRONT,	headFront);
	addMesh(MIC_HEAD_BACK,	headBack);
	addMesh(MIC_CORE,		core);

	Transform();
	vertices.shrink_to_fit();
	edges.shrink_to_fit();
	polygons.shrink_to_fit();

//	flipNormals(0, polygons.size());
}
Beispiel #13
0
// on "init" you need to initialize your instance
bool GameScene::init()
{
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    srand(getpid());
    _moleInterval = 2.5f;
	_moleTimer = _moleInterval * 0.99f;
    
    _difficultyInterval = 5.0f;
    _difficultyTimer = _difficultyInterval * 0.99f;
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    _background = CCSprite::create("background.png");
    _background->setPosition(ccp(size.width / 2, size.height / 2));
    _background->retain();
    this->addChild(_background, 0);
    
    for (int i = 0; i < 9; i++) {
        Hole* newHole = new Hole(i);
        
        _holes.push_back(newHole);
        this->addChild(newHole->getSprite(), 0);
    }
    
    _ui = CCSprite::create("score_life_time_ui.png");
    _ui->setPosition(ccp(size.width / 2, size.height - 50));
    _ui->retain();
    this->addChild(_ui, 0);
    
    _life1 = CCSprite::create("life.png");
    _life1->setPosition(ccp(size.width - 162.5, size.height - 45));
    _life1->retain();
    this->addChild(_life1, 0);
    
    _life2 = CCSprite::create("life.png");
    _life2->setPosition(ccp(size.width - 100, size.height - 45));
    _life2->retain();
    this->addChild(_life2, 0);
    
    _life3 = CCSprite::create("life.png");
    _life3->setPosition(ccp(size.width - 37.5, size.height - 45));
    _life3->retain();
    this->addChild(_life3, 0);
    
    _score = 0;
    _scoreLabel = CCLabelTTF::create("0", "Arial", 20);
    _scoreLabel->setPosition(ccp(240, size.height - 52));
    _scoreLabel->retain();
    this->addChild(_scoreLabel);
    
    _time = 0;
    _timeLabel = CCLabelTTF::create("00:00", "Arial", 20);
    _timeLabel->setPosition(ccp(580, size.height - 52));
    _timeLabel->retain();
    this->addChild(_timeLabel);
    
    _moleStayInterval = 5.0f;
    
    _parasectTimer = 0.f;
    
    _parasectAction = CCRepeat::create(CCSequence::createWithTwoActions(CCMoveBy::create(0.1, ccp(5, 5)), CCMoveBy::create(0.1, ccp(-5, -5))), 10);
    _parasectAction->retain();
    
    //listen for touches
    this->setTouchEnabled(true);
    
    //create main loop
    this->schedule(schedule_selector(GameScene::update));
    
    return true;
}