52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
//
|
|
// Created by bruno on 28.10.2023.
|
|
//
|
|
|
|
#ifndef TUNELLERBUTWORSE_PLAYER_H
|
|
#define TUNELLERBUTWORSE_PLAYER_H
|
|
|
|
#include <vector>
|
|
#include "Sprite.h"
|
|
|
|
class Player {
|
|
public:
|
|
// Constructor
|
|
|
|
Player(int initialX, int initialY, Sprite *sprite, int hudHeight, SDL_Rect *screenRect);
|
|
|
|
// Input processing method
|
|
void processInput(SDL_Event* event);
|
|
|
|
// Movement methods
|
|
void move(int deltaX, int deltaY);
|
|
void moveTo(int x, int y);
|
|
|
|
// Shooting method
|
|
void shoot();
|
|
|
|
// Collision detection methods
|
|
bool checkCollisionWith(Sprite* otherSprite);
|
|
|
|
bool checkCollisionWithEverything(const std::vector<Sprite>& entities);
|
|
|
|
int render(SDL_Renderer* renderer);
|
|
|
|
void renderHUD(SDL_Renderer *renderer);
|
|
|
|
private:
|
|
// Member variables for the player's position, etc.
|
|
int x, y, direction, health, energy, maxHealth, maxEnergy, hudHeight;
|
|
|
|
SDL_Rect screenRect;
|
|
// Add any other member variables as needed
|
|
|
|
// Member variable for the player's sprite
|
|
Sprite *playerSprite;
|
|
// You can use the Sprite class to manage the player's graphical representation
|
|
|
|
// Add any other private member functions as needed
|
|
};
|
|
|
|
|
|
#endif //TUNELLERBUTWORSE_PLAYER_H
|