This repository has been archived by the owner on Jun 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
/
Boomerang.h
85 lines (69 loc) · 2.83 KB
/
Boomerang.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (C) 2006-2012 Christopho, Solarus - http://www.solarus-games.org
*
* Solarus is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Solarus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLARUS_BOOMERANG_H
#define SOLARUS_BOOMERANG_H
#include "Common.h"
#include "entities/MapEntity.h"
/**
* @brief A boomerang thrown on the map.
*
* In the current implementation, only the hero is supposed to be able to
* throw a boomerang.
*/
class Boomerang: public MapEntity {
private:
Hero& hero; /**< the hero */
uint32_t next_sound_date; /**< date when the boomerang sound is played next time */
bool has_to_go_back; /**< true if the boomerang is about to go back */
bool going_back; /**< indicates that the boomerang is going back towards the hero */
Rectangle initial_coords; /**< coordinates of the boomerang's initial position */
int speed; /**< speed of the movement in pixels per second */
public:
Boomerang(Hero& hero, int max_distance, int speed, double angle,
const std::string& sprite_name);
~Boomerang();
EntityType get_type();
bool can_be_obstacle();
bool can_be_drawn();
// obstacles
bool is_teletransporter_obstacle(Teletransporter& teletransporter);
bool is_conveyor_belt_obstacle(ConveyorBelt& conveyor_belt);
bool is_stairs_obstacle(Stairs& stairs);
bool is_deep_water_obstacle();
bool is_hole_obstacle();
bool is_lava_obstacle();
bool is_prickle_obstacle();
bool is_ladder_obstacle();
bool is_switch_obstacle(Switch& sw);
bool is_raised_block_obstacle(CrystalBlock& raised_block);
bool is_crystal_obstacle(Crystal& crystal);
bool is_npc_obstacle(NPC& npc);
bool is_jumper_obstacle(Jumper& jumper);
// state
bool is_going_back();
void go_back();
void update();
// movement
void notify_obstacle_reached();
void notify_movement_finished();
// collisions
void notify_collision_with_switch(Switch& sw, CollisionMode collision_mode);
void notify_collision_with_crystal(Crystal& crystal, CollisionMode collision_mode);
void notify_collision_with_enemy(Enemy& enemy);
void notify_attacked_enemy(EnemyAttack attack, Enemy& victim, EnemyReaction::Reaction& result, bool killed);
};
#endif