- Timestamp:
- Jun 3, 2013, 11:05:20 PM (12 years ago)
- Branches:
- master
- Children:
- d03ec0f
- Parents:
- 8a4ed74
- Location:
- common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Message.h
r8a4ed74 r8dad966 2 2 #define _MESSAGE_H 3 3 4 #define MSG_TYPE_REGISTER 1 5 #define MSG_TYPE_LOGIN 2 6 #define MSG_TYPE_LOGOUT 3 7 #define MSG_TYPE_CHAT 4 8 #define MSG_TYPE_PLAYER 5 // server sends this to update player positions 9 #define MSG_TYPE_PLAYER_MOVE 6 // client sends this when a player wants to move 10 #define MSG_TYPE_OBJECT 7 11 #define MSG_TYPE_REMOVE_OBJECT 8 12 #define MSG_TYPE_PICKUP_FLAG 9 13 #define MSG_TYPE_DROP_FLAG 10 14 #define MSG_TYPE_SCORE 11 15 #define MSG_TYPE_START_ATTACK 12 16 #define MSG_TYPE_ATTACK 13 4 #define MSG_TYPE_REGISTER 1 5 #define MSG_TYPE_LOGIN 2 6 #define MSG_TYPE_LOGOUT 3 7 #define MSG_TYPE_CHAT 4 8 #define MSG_TYPE_PLAYER 5 // server sends this to update player positions 9 #define MSG_TYPE_PLAYER_MOVE 6 // client sends this when a player wants to move 10 #define MSG_TYPE_OBJECT 7 11 #define MSG_TYPE_REMOVE_OBJECT 8 12 #define MSG_TYPE_PICKUP_FLAG 9 13 #define MSG_TYPE_DROP_FLAG 10 14 #define MSG_TYPE_SCORE 11 15 #define MSG_TYPE_START_ATTACK 12 16 #define MSG_TYPE_ATTACK 13 17 #define MSG_TYPE_PROJECTILE 14 18 #define MSG_TYPE_REMOVE_PROJECTILE 14 17 19 18 20 typedef struct -
common/Player.cpp
r8a4ed74 r8dad966 16 16 this->pos.y = this->target.y = 0; 17 17 this->timeLastUpdated = 0; 18 this->timeAttackStarted = 0; 19 this->isAttacking = false; 18 20 19 21 this->playerClass = CLASS_NONE; … … 22 24 this->attackType = ATTACK_NONE; 23 25 this->damage = 0; 26 this->attackCooldown = 0; 24 27 this->team = 0; // blue team by default 25 28 this->hasBlueFlag = false; … … 38 41 this->target.y = p.target.y; 39 42 this->timeLastUpdated = p.timeLastUpdated; 43 this->timeAttackStarted = p.timeAttackStarted; 44 this->isAttacking = p.isAttacking; 40 45 41 46 this->playerClass = p.playerClass; … … 44 49 this->attackType = p.attackType; 45 50 this->damage = p.damage; 51 this->attackCooldown = p.attackCooldown; 46 52 this->team = p.team; 47 53 this->hasBlueFlag = p.hasBlueFlag; … … 57 63 this->pos.x = this->target.x = 200; 58 64 this->pos.y = this->target.y = 200; 65 this->timeLastUpdated = 0; 66 this->timeAttackStarted = 0; 67 this->isAttacking = false; 59 68 60 69 this->playerClass = CLASS_NONE; … … 63 72 this->attackType = ATTACK_NONE; 64 73 this->damage = 0; 74 this->attackCooldown = 0; 65 75 this->team = 0; // blue team by default 66 76 this->hasBlueFlag = false; … … 87 97 case CLASS_WARRIOR: 88 98 this->playerClass = CLASS_WARRIOR; 89 this->maxHealth = this->health = 1 00;99 this->maxHealth = this->health = 120; 90 100 this->attackType = ATTACK_MELEE; 91 101 this->damage = 10; 102 this->attackCooldown = 800; 92 103 break; 93 104 case CLASS_RANGER: … … 96 107 this->attackType = ATTACK_RANGED; 97 108 this->damage = 6; 109 this->attackCooldown = 1000; 98 110 break; 99 111 case CLASS_NONE: -
common/Player.h
r8a4ed74 r8dad966 58 58 POSITION target; 59 59 unsigned long long timeLastUpdated; 60 unsigned long long timeAttackStarted; 61 bool isAttacking; 62 int targetPlayer; 60 63 61 64 int playerClass; … … 64 67 int attackType; 65 68 int damage; 69 unsigned long long attackCooldown; 66 70 int team; // 0 is blue, 1 is red 67 71 bool hasBlueFlag;
Note:
See TracChangeset
for help on using the changeset viewer.