-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.h
61 lines (43 loc) · 1.37 KB
/
Item.h
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
52
53
54
55
56
57
58
59
60
61
#ifndef ITEM_H_
#define ITEM_H_
#include "cocos2d.h"
#include "Animation.h"
#include <vector>
namespace dxco {
class Item {
public:
Item(cocos2d::CCSprite* sprite, std::map<int, Animation*>& animations);
virtual void update(float dt);
virtual void updatePosition(float speed, float dt);
virtual int getState();
virtual cocos2d::CCPoint getLocation();
virtual float getHeight();
virtual float getWidth();
virtual float getX();
virtual float getY();
virtual float getTopPosition();
virtual float getBottomPosition();
virtual float getRightPosition();
virtual float getLeftPosition();
virtual void move(float deltaX, float deltaY);
virtual void moveTo(float x, float y);
virtual void restartPosition();
virtual cocos2d::CCSprite* getSprite();
virtual void goTo(cocos2d::CCPoint point, float distance);
virtual bool collides(Item* item);
virtual bool isOutOfScreen();
virtual bool canAdvance(cocos2d::CCPoint target, float distance, std::vector<Item*> &items);
virtual bool isVisible();
virtual bool isActive();
virtual float getColitionRatio();
bool inVisionRange(Item* item, float visionRange, float angleRange, float distance, float thisRotation);
protected:
cocos2d::CCSprite* sprite;
cocos2d::CCTexture2D* defaultTexture;
std::map<int, Animation*> animations;
float xInitial;
float yInitial;
int state;
};
} /* namespace dxco */
#endif /* ITEM_H_ */