-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathObject.h
More file actions
48 lines (39 loc) · 1.79 KB
/
Copy pathObject.h
File metadata and controls
48 lines (39 loc) · 1.79 KB
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
#pragma once
#include "Header.h"
class Object
{
protected:
double speed;
int countX{ 1 }; int countY{ 1 }; int x0{ 0 }; int y0{ 0 };
float currentFrameX{ 0 }; float currentFrameY{ 0 };
UtilitiesGame::TextureData movementTexture; UtilitiesGame::SizeXY valueSizeXY;
virtual int actionCollisionTields();
virtual int actionCollisionObjects(Object* obj) = 0;
public:
double dx, dy;
Object(const sf::String& ImageFile, int maxFrameX, int maxFrameY, double speed = 0);
~Object();
sf::Sprite getSprite();
bool setPos(double x, double y);
bool setMaxFrames(int countX, int countY);
virtual int move(double x, double y);
virtual int teleport(double x, double y);
virtual bool animation(int direction) = 0;// Âûáîð àíèìàöèè
virtual int update(sf::Event) = 0;
const sf::Vector2f& getPosition();
const UtilitiesGame::SizeXY& getSizeXY();
//static void IntersectsWalls(std::vector<Object*> &vector);
void setCollisionTieldsFlag(const int collisionTieldsFlag);
const int getCollisionTieldsFlag();
void setCollisionObjectsFlag(const int collisionObjectsFlag);
const int getCollisionObjectsFlag();
static std::vector<Object*> objectsAll;
private:
bool checkManyTieldsIntersection(UtilitiesGame::SpeedXY& speedXY, int i, int j, int direction);
bool checkTieldsIntersection(UtilitiesGame::SpeedXY &speedXY, sf::FloatRect rect, sf::FloatRect rect2, int number, int directionFlag/*0 - íå áëîêèðóåò êîîðäèíàòû, 1 - áëîêèðóåò X, 2 - áëîêèðóåò Y*/);
int collisionTieldsFlag, collisionObjectsFlag;
bool checkObjectsCollision(UtilitiesGame::SpeedXY& speedXY);
void changeIntersection(UtilitiesGame::SpeedXY& speedXY, sf::FloatRect rect2, int directionFlag/*0 - íå áëîêèðóåò êîîðäèíàòû, 1 - áëîêèðóåò X, 2 - áëîêèðóåò Y*/);
bool checkTeleportIntersects(double& x, double& y);
void checkAndChangeIJ(int& i, int& j);
};