PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
obj_player.h
1 /*
2  * Platformer Game Engine by Wohlstand, a free platform for game making
3  * Copyright (c) 2015 Vitaly Novichkov <admin@wohlnet.ru>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef OBJ_PLAYER_H
20 #define OBJ_PLAYER_H
21 
22 #include <graphics/graphics.h>
23 #include <common_features/player_calibration.h>
24 
25 #include <QString>
26 #include <QPixmap>
27 #include <QMap>
28 #include <QList>
29 
30 /****************Definition of playable character state*******************/
32 {
34  inline void make() {}
35  float walk_force;
36  float run_force;
37 
42 
43  float ground_c_max;
44  float ground_c;
45  float slippery_c;
46 
47  float gravity_accel;
48  float gravity_scale;
49  float velocity_jump;
53  int jump_time;
56 
60 
61  float MaxSpeed_walk;
62  float MaxSpeed_run;
63 
64  float MaxSpeed_up;
65  float MaxSpeed_down;
66 
68 
69  bool zero_speed_y_on_enter;
71  bool slow_speed_x_on_enter;
73 };
74 
76 {
77  inline void make() {}
78  int width;
79  int height;
80  bool duck_allow;
81  int duck_height;
82  bool allow_floating;
83  int floating_max_time;
84  float floating_amplitude;
85  QHash<int, obj_player_physics > phys;
86  QString event_script;
87 
88  obj_player_calibration sprite_setup;
89 
90  QString image_n;
91  QString mask_n;
92  /* OpenGL */
93  bool isInit;
94  PGE_Texture *image;
95  GLuint textureID;
96  long textureArrayId;
97  long animator_ID;
98  /* OpenGL */
99 };
100 
101 
102 /******************Definition of playable character*********************/
104 {
105  inline void make();
106  unsigned long id;
107  QString image_wld_n;
108  QString mask_wld_n;
109 
110  int matrix_width;
111  int matrix_height;
112 
113  //Size of one frame (will be calculated automatically!)
114  int frame_width;
115  int frame_height;
116 
117  /* OpenGL */
118  //for world map
119  bool isInit_wld;
120  PGE_Texture *image_wld;
121  GLuint textureID_wld;
122  long textureArrayId_wld;
123  long animator_ID_wld;
124  /* OpenGL */
125 
126  QString name;
127  QString sprite_folder;
128  enum StateTypes
129  {
130  powerup=0,
131  suites
132  };
133  int state_type;
134 
135 /* World map */
136  int wld_framespeed;
137  int wld_frames;
138  int wld_offset_y;
139  QList<int > wld_frames_up;
140  QList<int > wld_frames_right;
141  QList<int > wld_frames_down;
142  QList<int > wld_frames_left;
143 /* World map */
144 
145  QHash<int, obj_player_state > states;
146  QHash<int, obj_player_physics > phys_default;
147 
148  QString event_script;
149 
150  bool allowFloating;
151 };
152 
153 #endif // OBJ_PLAYER_H
154 
float velocity_jump
Jump velocity.
Definition: obj_player.h:49
float decelerate_turn
Deceleration while turning.
Definition: obj_player.h:40
float slow_speed_x_coeff
Coefficient to slow speed.
Definition: obj_player.h:72
bool strict_max_speed_on_ground
reduce speed to max if faster than allowed on ground
Definition: obj_player.h:67
Definition: pge_texture.h:32
void make()
Dummy function.
Definition: obj_player.h:34
float slow_up_speed_y_coeff
Coefficient to slow speed if it going up.
Definition: obj_player.h:70
float run_force
Running force.
Definition: obj_player.h:36
float velocity_climb_x
Climbing velocity.
Definition: obj_player.h:57
void make()
Dummy function.
Definition: obj_player.h:77
float MaxSpeed_up
Fly UP Max fall speed.
Definition: obj_player.h:64
obj_player_physics()
Definition: obj_player.cpp:101
float slippery_c
Slippery accelerations coefficien.
Definition: obj_player.h:45
QString event_script
Global player's LUA-Script with events.
Definition: obj_player.h:148
int jump_time
Time to jump.
Definition: obj_player.h:53
float walk_force
Move force.
Definition: obj_player.h:35
float MaxSpeed_run
Max run speed.
Definition: obj_player.h:62
int jump_time_bounce
Time to bounce.
Definition: obj_player.h:54
float velocity_climb_y_up
Climbing velocity.
Definition: obj_player.h:58
Definition: obj_player.h:103
Definition: obj_player.h:31
float decelerate_air
Decelerate in air.
Definition: obj_player.h:41
float ground_c
On-Ground accelerations coefficient.
Definition: obj_player.h:44
Definition: player_calibration.h:56
float MaxSpeed_down
Max fall down speed.
Definition: obj_player.h:65
void make()
Dummy function.
float decelerate_run
Deceleration running while speed higher than walking.
Definition: obj_player.h:39
float decelerate_stop
Deceleration while stopping.
Definition: obj_player.h:38
float velocity_jump_c
Jump coefficient which provides increzed jump height dependent to speed.
Definition: obj_player.h:52
float velocity_climb_y_down
Climbing velocity.
Definition: obj_player.h:59
float velocity_jump_bounce
Boubce velocity.
Definition: obj_player.h:50
float MaxSpeed_walk
Max walk speed.
Definition: obj_player.h:61
float gravity_accel
Gravity acceleration.
Definition: obj_player.h:47
Definition: obj_player.h:75
float velocity_jump_spring
Jump velocity on spring.
Definition: obj_player.h:51
float ground_c_max
On-Ground max speed coefficient.
Definition: obj_player.h:43
QString event_script
LUA-Script with events.
Definition: obj_player.h:86
int jump_time_spring
Time to jump.
Definition: obj_player.h:55
float gravity_scale
Gravity scale.
Definition: obj_player.h:48