2016-03-13 17:33:47 +00:00
|
|
|
#ifndef DEF_XMARIOMARIO_H
|
|
|
|
|
|
|
|
#define DEF_XMARIOMARIO_H
|
|
|
|
|
2016-03-14 12:14:35 +00:00
|
|
|
|
|
|
|
/* [CST] Constantes et enumeration
|
|
|
|
=========================================================*/
|
|
|
|
#define XMARIO_VEL_HOR true // velocite verticale
|
|
|
|
#define XMARIO_VEL_VER false // velocite horizontale
|
|
|
|
|
|
|
|
/* [DEF] Definition de la classe
|
|
|
|
=========================================================*/
|
2016-03-13 17:33:47 +00:00
|
|
|
class xMarioMario : public xSpriteAnimation{
|
|
|
|
|
|
|
|
public:
|
|
|
|
xMarioMario(xManager *manager, int x, int y); // Spritesheet avec taille de chaque sprite
|
|
|
|
|
2016-03-16 09:17:28 +00:00
|
|
|
// Surcharge parent
|
|
|
|
void onCollide(vector<int> from, xSprite* by);
|
|
|
|
|
2016-03-14 12:14:35 +00:00
|
|
|
void moveFromVelocity();
|
|
|
|
|
2016-03-14 18:28:18 +00:00
|
|
|
// Changement de frames en fonction du mouvement
|
|
|
|
void turn();
|
2016-03-14 12:14:35 +00:00
|
|
|
|
|
|
|
// GETTER
|
|
|
|
double velocity(bool way=XMARIO_VEL_HOR); // Recupere velocite
|
|
|
|
bool onFloor(); // Si mario est sur le sol
|
2016-03-16 13:49:05 +00:00
|
|
|
bool onWall(); // Si mario est contre un mur
|
2016-03-14 12:14:35 +00:00
|
|
|
|
|
|
|
// SETTER
|
|
|
|
void velocity(double x=0.0, double y=0.0); // Modification de velocite
|
|
|
|
|
|
|
|
|
|
|
|
// Gestion du suivi du deplacement
|
|
|
|
bool _left;
|
|
|
|
bool _right;
|
|
|
|
bool _up;
|
|
|
|
bool _down;
|
|
|
|
|
2016-03-14 15:10:21 +00:00
|
|
|
int _jumps;
|
|
|
|
|
2016-03-14 18:28:18 +00:00
|
|
|
// Etat physique
|
|
|
|
string _pos;
|
|
|
|
|
2016-03-13 19:36:16 +00:00
|
|
|
|
2016-03-13 17:33:47 +00:00
|
|
|
private:
|
2016-03-13 19:36:16 +00:00
|
|
|
Uint32 _lastmove;
|
2016-03-14 12:14:35 +00:00
|
|
|
double _velocity[2];
|
2016-03-14 15:10:21 +00:00
|
|
|
double _gravity;
|
2016-03-14 12:14:35 +00:00
|
|
|
|
|
|
|
double _mult[2];
|
|
|
|
double _min_vel[2];
|
|
|
|
double _max_vel[2];
|
|
|
|
double _acc[2];
|
|
|
|
double _dec[2];
|
2016-03-13 19:36:16 +00:00
|
|
|
|
|
|
|
|
2016-03-13 17:33:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|