2017-04-29 18:43:17 +00:00
|
|
|
//Player class header
|
|
|
|
|
|
|
|
#ifndef __PLAYER_H_INCLUDED__
|
|
|
|
#define __PLAYER_H_INLCUDED__
|
|
|
|
|
|
|
|
#include<SDL2/SDL.h>
|
|
|
|
#include<iostream>
|
2017-05-01 17:40:03 +00:00
|
|
|
#include<cmath>
|
2017-04-29 18:43:17 +00:00
|
|
|
#include"dt.h"
|
|
|
|
#include"entity.h"
|
2017-05-01 17:40:03 +00:00
|
|
|
#include"texture.h"
|
2017-04-29 18:43:17 +00:00
|
|
|
|
|
|
|
class Entity;
|
|
|
|
|
|
|
|
class Player: public Entity{
|
|
|
|
public:
|
2017-04-30 16:23:47 +00:00
|
|
|
void print(int cameraX);
|
2017-04-29 18:43:17 +00:00
|
|
|
int check(SDL_Rect rectB);
|
|
|
|
void init(int x, int y,int w, int h,SDL_Renderer** render);
|
|
|
|
private:
|
|
|
|
int* coll;
|
2017-05-01 17:40:03 +00:00
|
|
|
bool loadMedia();
|
2017-04-29 18:43:17 +00:00
|
|
|
void move();
|
|
|
|
int intVelX();
|
|
|
|
SDL_Renderer** renderer;
|
|
|
|
DeltaTime dTime;
|
|
|
|
bool ground;
|
|
|
|
bool topCollision;
|
|
|
|
//int posX, posY;
|
|
|
|
float velocityX = 0;
|
|
|
|
float velocityY = 0;
|
|
|
|
bool isRunning = false;
|
2017-05-01 17:40:03 +00:00
|
|
|
bool ifRunning = false;
|
2017-04-29 18:43:17 +00:00
|
|
|
int oldPosX, oldPosY;
|
2017-05-01 17:40:03 +00:00
|
|
|
|
|
|
|
PosuTexture ply;
|
|
|
|
SDL_Rect* currentFrame;
|
|
|
|
const static int plyNum = 6;
|
|
|
|
SDL_Rect plyFrame[plyNum];
|
2017-04-29 18:43:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|