Skip to content

Commit

Permalink
Try shield
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalavoine committed Jan 12, 2020
1 parent e715608 commit ade0ab6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions headers/MapObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,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;
Expand Down
6 changes: 6 additions & 0 deletions source/MapObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ MapObject::MapObject(int x, int y, int width, int height, bool noclip) {
this->havechanged = false;
this->garbage_collect = false;
this->drawsprite=true;
this->transmitted[1]=true;

}

MapObject::~MapObject(){ }
void MapObject::move() { std::cout << "momove" << std::endl; havechanged=true;}

std::string MapObject::encode_spell(){

}

void MapObject::set_x(int x) {
this->x=x;
}
Expand Down
1 change: 1 addition & 0 deletions source/Spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Spell::Spell(int x, int y, float dir_x, float dir_y, int width, int height, bool
this->havechanged = false;
this->id=(x+y+int(rand())*1000)%5943;
this->transmitted;
this->transmitted[1]=false;
this->isBorS=false;
}
Spell::~Spell() { }
Expand Down
8 changes: 7 additions & 1 deletion source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,13 @@ void game_loop (Gamestatus* game_status, bool &redraw, ALLEGRO_EVENT_QUEUE* &que
if (spell_created){
spell_created=false;
for(std::list<Spell*>::iterator i = map->spells.begin(); i != map->spells.end(); i++){
std::cout<<"to launch"<<std::endl;
if(!(*i)->transmitted[1]){
(*i)->transmitted[1]=true;
(*i)->transmitted[client_number]=true;
(*interface).send_string((*i)->encode_spell());
}
}
for(std::list<MapObject*>::iterator i = map->statics.begin(); i != map->statics.end(); i++){
if(!(*i)->transmitted[1]){
(*i)->transmitted[1]=true;
(*i)->transmitted[client_number]=true;
Expand Down

0 comments on commit ade0ab6

Please sign in to comment.