Made some adjustments to the game's ranging
This commit is contained in:
parent
8550b0f8f1
commit
d2322a7caf
2
game.cpp
2
game.cpp
|
@ -4,7 +4,7 @@
|
|||
#include "debug.h"
|
||||
#include <SDL.h>
|
||||
|
||||
int Game::NODE_RADIUS = 12;
|
||||
int Game::NODE_RADIUS = 10;
|
||||
|
||||
|
||||
Game::Game(SDL_Surface* display)
|
||||
|
|
2
game.h
2
game.h
|
@ -38,8 +38,6 @@ class Game : public GameState
|
|||
GameData data;
|
||||
|
||||
static int NODE_RADIUS;
|
||||
static int MAX_MOVE_DISTANCE;
|
||||
|
||||
|
||||
// surfaces containing textures to draw
|
||||
SDL_Surface* background;
|
||||
|
|
|
@ -10,6 +10,8 @@ using std::list;
|
|||
int GameData::PLAYER1_COLOUR = 0x4a483f;
|
||||
int GameData::PLAYER2_COLOUR = 0x090c7a;
|
||||
|
||||
int GameData::BASE_MOVE_RADIUS = 75;
|
||||
|
||||
GameData::GameData()
|
||||
: Graph(true)
|
||||
{
|
||||
|
@ -180,17 +182,17 @@ int GameData::get_range(Vertex* node)
|
|||
if (node == NULL) node = current;
|
||||
|
||||
if (node == NULL) return 0;
|
||||
else if (mode == MODE_MOVE) return 100;
|
||||
else if (mode == MODE_MOVE) return BASE_MOVE_RADIUS;
|
||||
else if (mode == MODE_ATTACK)
|
||||
{
|
||||
int range = 200;
|
||||
int range = BASE_MOVE_RADIUS;
|
||||
list<Vertex*> neighbors = node->neighbors;
|
||||
|
||||
for(list<Vertex*>::iterator cursor = neighbors.begin();
|
||||
cursor != neighbors.end(); cursor++)
|
||||
{
|
||||
Vertex* v = *cursor;
|
||||
range -= 100 - MathUtils::distance(v->x, v->y, node->x, node->y);
|
||||
range -= (100 - MathUtils::distance(v->x, v->y, node->x, node->y)) / 2;
|
||||
}
|
||||
if (range < 0) range = 0;
|
||||
return range;
|
||||
|
|
|
@ -52,6 +52,8 @@ class GameData : public Graph
|
|||
|
||||
static int PLAYER1_COLOUR;
|
||||
static int PLAYER2_COLOUR;
|
||||
|
||||
static int BASE_MOVE_RADIUS;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user