Missile

The Missile class represents each missile in the game, no matter who fired it (player or enemy).

This class is derived from the AEntity interface and implements some of its methods.

Public member functions

// Construct a new Missile object
Missile(Room &room, Missile::Type type, u_int id, short x, short y);
// Construct a new Missile object
Missile(Room &room, Missile::Type type, u_int id, const std::pair<short, short> &pos);
// Refresh the missile (move and send the new position to the clients)
virtual void refresh();

Member functions documentation

Constructor

The constructor of the Missile class.

Missile(Room &room, Missile::Type type, u_int id, short x, short y);
Missile(Room &room, Missile::Type type, u_int id, const std::pair<short, short> &pos);

Parameters

  • room: A reference to the room in which the missile is.

  • type: The type of the missile.

  • id: The id of the missile.

  • x: The x position of the missile.

  • y: The y position of the missile.

  • pos: A pair of short containing the position of the missile (x, y).

refresh

This function refreshes the missile (move and send the new position to the clients).

virtual void refresh();