Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 3, 2014, 4:33:54 PM (10 years ago)
Author:
erbj
Message:

Added TDCoordinate and more updates

Location:
code/branches/towerdefenseHS14/src/modules/towerdefense
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt

    r10091 r10105  
    55  TowerDefenseHUDController.cc
    66  TowerDefensePlayerStats.cc
    7   TowerTurret.cc
     7  TDCoordinate.cc
     8  Enemy.cc
     9
    810)
    911
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc

    r10091 r10105  
    7878#include "TowerTurret.h"
    7979#include "TowerDefenseCenterpoint.h"
    80 
     80//#include "TDCoordinate.h"
    8181#include "worldentities/SpawnPoint.h"
    8282#include "worldentities/pawns/Pawn.h"
     
    131131
    132132        const int kInitialTowerCount = 3;
    133         Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}};
    134133
    135134        for (int i = 0; i < kInitialTowerCount; i++)
    136135        {
    137             Coordinate coordinate = initialTowerCoordinates[i];
    138             addTower(coordinate.x, coordinate.y);
     136                //{{3,2}, {8,5}, {12,10}}; old coordinates
     137            TDCoordinate* coordinate = new TDCoordinate(i,(i*2));
     138            addTower(coordinate->x, coordinate->y);
    139139        }
    140140
     
    144144    }
    145145
     146    void TowerDefense::addEnemy(){}
     147
     148
    146149    void TowerDefense::end()
    147150    {
     
    150153        ChatManager::message("Match is over");
    151154    }
     155
     156
    152157
    153158    void TowerDefense::addTower(int x, int y)
     
    184189
    185190        // Add tower to coordinatesStack
    186         Coordinate newTowerCoordinates = {x, y};
     191        TDCoordinate newTowerCoordinates;
     192        newTowerCoordinates.x=x;
     193        newTowerCoordinates.y=y;
     194
     195
    187196        addedTowersCoordinates_.push_back(newTowerCoordinates);
    188197
     
    205214    bool TowerDefense::towerExists(int x, int y)
    206215    {
    207         for(std::vector<Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)
    208         {
    209             Coordinate currentCoordinates = (Coordinate) (*it);
     216        for(std::vector<TDCoordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)
     217        {
     218            TDCoordinate currentCoordinates = (TDCoordinate) (*it);
    210219            if (currentCoordinates.x == x && currentCoordinates.y == y)
    211220                return true;
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h

    r10091 r10105  
    3737#ifndef _TowerDefense_H__
    3838#define _TowerDefense_H__
    39 
     39#include "TDCoordinate.h"
    4040#include "towerdefense/TowerDefensePrereqs.h"
    4141#include "gametypes/Deathmatch.h"
     
    5151        virtual ~TowerDefense();
    5252
     53        void addEnemy();
    5354        virtual void start(); //<! The function is called when the gametype starts
    5455        virtual void end();
     
    8687        bool towerExists(int x, int y);
    8788
    88         typedef struct {
    89             int x;
    90             int y;
    91         } Coordinate;
    9289
    93         std::vector<Coordinate> addedTowersCoordinates_;
     90        std::vector<TDCoordinate> addedTowersCoordinates_;
    9491        std::vector<TowerTurret*> towers_;
    9592    };
Note: See TracChangeset for help on using the changeset viewer.