Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 11, 2013, 4:01:44 PM (10 years ago)
Author:
zifloria
Message:

enemies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/invaders/src/modules/invader/Invader.cc

    r9709 r9777  
    4242#include "chat/ChatManager.h"
    4343
    44 #include "InvaderShip.h"
    4544// ! HACK
    4645#include "infos/PlayerInfo.h"
    4746
    4847#include "InvaderCenterPoint.h"
     48#include "InvaderShip.h"
     49
     50#include "core/command/ConsoleCommand.h"
    4951
    5052namespace orxonox
     
    5557    {
    5658        RegisterObject(Invader);
     59        this->center_ = 0;
    5760
    58         this->center_ = 0;
     61        this->console_addEnemy = createConsoleCommand( "spawnEnemy", createExecutor( createFunctor(&Invader::spawnEnemy, this) ) );
    5962        //this->context = context;
     63
     64        enemySpawnTimer.setTimer(2.0f, true, createExecutor(createFunctor(&Invader::spawnEnemy, this)));
    6065    }
    6166
    6267    Invader::~Invader()
    6368    {
     69    }
     70
     71    void Invader::spawnEnemy()
     72    {
     73        if (player == NULL)
     74        {
     75            for (ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)
     76                player = *it;
     77        }
     78        if (player == NULL)
     79            return;
     80
     81        Pawn* newPawn = new Pawn(this->center_->getContext());
     82        newPawn->addTemplate("enemyinvader");
     83
     84        newPawn->setPosition(player->getPosition() + Vector3(1000, 0, 0));
    6485    }
    6586
Note: See TracChangeset for help on using the changeset viewer.