-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhysics.cpp
More file actions
executable file
·51 lines (42 loc) · 930 Bytes
/
Copy pathPhysics.cpp
File metadata and controls
executable file
·51 lines (42 loc) · 930 Bytes
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
48
49
50
51
#include "Physics.h"
#include <SFML\Graphics.hpp>
#include "MapMgr.h"
#include "GameState.h"
bool testLeft(float x, float y)
{
bool noObject = true;
int modY = (int)y / 32;
sf::Vector2i current = getMap(x-1, y + modY);
if (current.x != -1)
noObject = false;
return noObject;
}
bool testRight(float x, float y)
{
bool noObject = true;
int modY = (int)y % 32;
sf::Vector2i current = getMap(x + 32, y + modY);
if (current.x != -1)
noObject = false;
return noObject;
}
bool testUp(float x, float y)
{
bool noObject = true;
int modX = (int)x % 32;
sf::Vector2i current = getMap(x + modX, y - 1);
if (current.y != -1)
noObject = false;
return noObject;
}
bool testDown(float x, float y)
{
bool noObject = true;
int modX = (int)x % 32;
sf::Vector2i current = getMap(x + modX, y + 32);
if (current.y != -1)
{
noObject = false;
}
return noObject;
}