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
/
JumpMovement.h
67 lines (51 loc) · 2.01 KB
/
JumpMovement.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
/*
* 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_JUMP_MOVEMENT_H
#define SOLARUS_JUMP_MOVEMENT_H
#include "Common.h"
#include "movements/PixelMovement.h"
/**
* @brief Movement of an entity that jumps towards a direction.
*
* TODO: inherit StraightMovement instead?
*/
class JumpMovement: public PixelMovement {
public:
JumpMovement(int direction8, int distance, int speed, bool ignore_obstacles);
~JumpMovement();
int get_direction8();
void set_direction8(int direction8);
int get_distance();
void set_distance(int distance);
int get_speed();
void set_speed(int speed);
int get_displayed_direction4();
const Rectangle get_displayed_xy();
virtual const std::string& get_lua_type_name() const;
protected:
void notify_step_done(int step_index, bool success);
private:
static const std::string basic_trajectories[]; /**< one-pixel trajectory of each direction */
// properties
int direction8; /**< direction of the jump (0 to 7) */
int distance; /**< jump length in pixels */
int speed; /**< speed in pixels per second */
// state
int jump_height; /**< current height of the object while jumping */
void restart();
};
#endif