Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtraordinaire9911 committed Jan 12, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 1d7bc8c + 5073ad1 commit bf78510
Showing 46 changed files with 1,170 additions and 129 deletions.
84 changes: 84 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"cstring": "cpp",
"map": "cpp",
"chrono": "cpp",
"__bit_reference": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"bitset": "cpp",
"complex": "cpp",
"ctime": "cpp",
"ios": "cpp",
"locale": "cpp",
"mutex": "cpp",
"queue": "cpp",
"ratio": "cpp",
"variant": "cpp",
"csignal": "cpp",
"codecvt": "cpp",
"condition_variable": "cpp",
"set": "cpp",
"future": "cpp",
"iomanip": "cpp",
"thread": "cpp",
"typeindex": "cpp"
}
}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ Notice that the files `main` and `game` are in .gitignore, remove if required.
* Mihails
* Yasamin
* Seorim
* Wanqi
* Wanqi <br>
link to the google sheet : https://docs.google.com/spreadsheets/d/1U292Xuc60-sqPbSf0No7_KN3GhcqFwKOEsrraRNXdxw/edit?usp=sharing

### Team 4: Networking:
@@ -60,3 +60,11 @@ link to the google sheet : https://docs.google.com/spreadsheets/d/1U292Xuc60-sqP
- make for linux
- make mac for mac users
* Then, write ./game to run the game
* The connection to the server:
- Once the server is running on one computer, an another player can connect to the server by putting the ip after clicking on "join game".
- the maximum number of player that can join a game is 2, due to the server capacity.
* The rule:
-We have 3 control points on the map : the player should capture all the control points and kill the opponent in order to win the game. There are multiple spells that can kill or heal players, and the player should combine elements with keys to cast spells (life=u, shield=i, fire=o, water=j, ice=k, rock=l). The selected elements are on the bottom right.(see link to the google sheet above for the list of spells)



3 changes: 3 additions & 0 deletions Settings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1280
720
1
Binary file added file
Binary file not shown.
2 changes: 2 additions & 0 deletions headers/Beam.hpp
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ class Beam: public Spell {
void move();

virtual void draw(int camera_x, int camera_y);
//std::string encode_spell();
void set_mouse_down(bool &iamnot);

protected:
float range;
4 changes: 2 additions & 2 deletions headers/Controlpoint.hpp
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ class Controlpoint : public MapObject {
Controlpoint(int x, int y, int number, int side, int owner);
~Controlpoint();

void set_owner(short newowner);
void set_owner(int newowner);

int get_owner();

@@ -23,7 +23,7 @@ class Controlpoint : public MapObject {
int get_timetoget();
void change_tgot(int tgot);
void change_ttoget(int ttoget);
void change_owner(bool updated);
void change_owner(int updated);
bool get_havechanged();
void reset_havechanged();

1 change: 1 addition & 0 deletions headers/DealingB.hpp
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
class DealingB: public Beam {
public:
DealingB(std::list<Player*>::iterator &pit, float* dxp, float* dyp, bool* mouse_down, Map* map);
DealingB(std::list<Player*>::iterator &pit, float* dxp, float* dyp, bool* mouse_down, Map* map, int IP, bool transmitted[5]);
~DealingB();

int get_damage();
27 changes: 27 additions & 0 deletions headers/FireShield.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once
#include "MapObject.hpp"
#include "Spells.hpp"
#include "Shield.hpp"
#include "Spells.hpp"
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
#include <list>

class FireShield: public Shield {
public:
FireShield(int start_x, int start_y, float dir_x, float dir_y,bool subshield);
~FireShield();

int get_damage();

virtual void on_collision(MapObject &other);
virtual void draw(int camera_x, int camera_y);

std::list<std::list<int>> generate_subshield_coordinates();

private:
ALLEGRO_BITMAP* sprite;
int damage;
bool subshield;
ALLEGRO_SAMPLE* music11;
};
1 change: 1 addition & 0 deletions headers/HealB.hpp
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
class HealB: public Beam {
public:
HealB(std::list<Player*>::iterator &pit, float* dxp, float* dyp, bool* mouse_down, Map* map);
HealB(std::list<Player*>::iterator &pit, float* dxp, float* dyp, bool* mouse_down, Map* map, int IP, bool transmitted[5]);
~HealB();

int get_damage();
1 change: 1 addition & 0 deletions headers/Interface.hpp
Original file line number Diff line number Diff line change
@@ -14,5 +14,6 @@ class Interface {
short get_client();
// event handlers
virtual void send_string(std::string);
bool connected;

};
5 changes: 4 additions & 1 deletion headers/MainShield.hpp
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@

class MainShield: public Shield {
public:
MainShield(int start_x, int start_y, float dir_x, float dir_y, bool subshield);
MainShield(int start_x, int start_y, float dir_x, float dir_y,bool subshield);
MainShield(int start_x, int start_y, float dir_x, float dir_y,bool subshield, int ID, bool transmitted[5]);
~MainShield();

int get_damage();
@@ -18,9 +19,11 @@ class MainShield: public Shield {
virtual void draw(int camera_x, int camera_y);

std::list<std::list<int>> generate_subshield_coordinates();
std::string encode_spell();

private:
ALLEGRO_BITMAP* sprite;
int damage;
bool subshield;
ALLEGRO_SAMPLE* music11;
};
9 changes: 6 additions & 3 deletions headers/Map.hpp
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@
#include <vector>
#include <sstream>
// #include <iostream>
#include <stdlib.h>
#include <time.h>

#include "Controlpoint.hpp"

@@ -24,7 +26,7 @@ class Map {
void garbage_collect();
void modif_lives(int team , bool change);
void check_dead();
void set_spawnpoints(int x1, int y1, int x2, int y2,int x3, int y3,int x4, int y4);
void set_spawnpoints(int x1, int y1, int x2, int y2,int x3, int y3);
bool game_ended();
int get_winner();

@@ -73,14 +75,15 @@ class Map {

std::list<Player*>::iterator fetch_pit(short n);
// still not sure: std::list<Spell>::iterator fetch_spit(short n);
bool iam;
bool iamnot;
private:
ALLEGRO_BITMAP* map;
int spawnpoint1[2];
int spawnpoint2[2];
int spawnpoint3[2];
int spawnpoint4[2];
bool spawnred = true;
bool spawnblue = true;
int spawns[4];
int spawns[3];
int winner = 0;
};
6 changes: 5 additions & 1 deletion headers/MapObject.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <string>
#include <allegro5/allegro5.h>
#include <cmath>

@@ -12,8 +13,11 @@ class MapObject {
virtual void move();
virtual void on_collision(MapObject &other);
virtual void hit(const int amount);
virtual std::string encode_spell();
// I addded a knockback function for the special functions of spray
virtual void knockback(float di_x, float di_y);
//virtual void preventhit();
bool transmitted[5];

int get_x() const;
int get_y() const;
@@ -28,7 +32,7 @@ class MapObject {
bool get_drawsprite() const;
int get_next_x();
int get_next_y();
unsigned int get_speed();
int get_speed();

protected:
bool noclip;
3 changes: 2 additions & 1 deletion headers/Minimap.hpp
Original file line number Diff line number Diff line change
@@ -3,14 +3,15 @@
#include <allegro5/allegro5.h>
#include <list>
#include "../headers/Player.hpp"
#include "../headers/Controlpoint.hpp"

class Minimap : public HUDobject {
public:
Minimap(const char* name, int win_x, int win_y);
~Minimap();
void update();
using HUDobject::draw;
void draw(std::list<Player*> players);
void draw(std::list<Player*> players, std::list<Controlpoint*> cp);

private:
ALLEGRO_BITMAP* map;
4 changes: 2 additions & 2 deletions headers/Player.hpp
Original file line number Diff line number Diff line change
@@ -75,11 +75,11 @@ class Player : public MapObject {
int old_y;
int dest_x;
int dest_y;
int hit_points=100;
int hit_points=200;
int lastgoodposx;
int lastgoodposy;
int count;
const char base_health = 100;
int base_health = 100;
bool damaged;
bool havechanged;
int game_state;
27 changes: 27 additions & 0 deletions headers/RockShield.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once
#include "MapObject.hpp"
#include "Spells.hpp"
#include "Shield.hpp"
#include "Spells.hpp"
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
#include <list>

class RockShield: public Shield {
public:
RockShield(int start_x, int start_y, float dir_x, float dir_y,bool subshield);
~RockShield();

int get_damage();

virtual void on_collision(MapObject &other);
virtual void draw(int camera_x, int camera_y);

std::list<std::list<int>> generate_subshield_coordinates();

private:
ALLEGRO_BITMAP* sprite;
int damage;
bool subshield;
ALLEGRO_SAMPLE* music11;
};
4 changes: 2 additions & 2 deletions headers/Server.hpp
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
using boost::asio::ip::udp;
class Server : public Interface{
public:
Server(boost::asio::io_service &io_service, unsigned short port, Gamestatus *gs);
Server(boost::asio::io_service &io_service, unsigned short port, Gamestatus *gs, short number_players);
~Server();
// event handlers

@@ -28,7 +28,7 @@ class Server : public Interface{
protected:

private:

short number_players;
boost::asio::io_service& io_service_;
udp::socket socket_;
udp::endpoint sender_endpoint_;
2 changes: 1 addition & 1 deletion headers/Shield.hpp
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

class Shield: public Spell {
public:
Shield(int start_x, int start_y, float dir_x, float dir_y, int width, int height, bool noclip, bool subshield);
Shield(int start_x, int start_y, float dir_x, float dir_y, int width, int height, bool noclip);
~Shield();
virtual void draw(int camera_x, int camera_y);

2 changes: 2 additions & 0 deletions headers/Spells.hpp
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ class Spell : public MapObject {
virtual void move();
bool transmitted [5]={false, false, false, false, false};
int counter;
bool isBorS;
virtual void set_mouse_down(bool &iamnot);

float get_dir_x();
float get_dir_y();
1 change: 1 addition & 0 deletions headers/WaterB.hpp
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
class WaterB: public Beam {
public:
WaterB(std::list<Player*>::iterator &pit, float* dxp, float* dyp, bool* mouse_down, Map* map);
WaterB(std::list<Player*>::iterator &pit, float* dxp, float* dyp, bool* mouse_down, Map* map, int IP, bool transmitted[5]);
~WaterB();

int get_damage();
Loading

0 comments on commit bf78510

Please sign in to comment.