-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGameLayer.h
More file actions
76 lines (72 loc) · 2.04 KB
/
GameLayer.h
File metadata and controls
76 lines (72 loc) · 2.04 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#include"cocos2d.h"
#include"Player.h"
#include"MenuLayer.h"
#include"endingScene.h"
#include"SimpleAudioEngine.h"
#include"Monster.h"
#include"Unit.h"
using namespace CocosDenshion;
class GameLevelLayer : public cocos2d::CCLayer
{
public:
GameLevelLayer(void) {};
~GameLevelLayer(void) {};
CREATE_FUNC(GameLevelLayer);
static Scene* createScene();
std::map<EventKeyboard::KeyCode, bool> keys;
bool init();
int screenWidth, screenHeight;
Point origin;
void onKeyPressed(EventKeyboard::KeyCode keycode, Event* event);
void onKeyReleased(EventKeyboard::KeyCode keycode, Event* event);
void update(float delta);
Player* _player;
Monster* _monster;
Unit*_unit;
float scale;
float X;
float Y;
bool isKeyPressed(EventKeyboard::KeyCode keycode);
bool sound;
void keyPressedDuration(EventKeyboard::KeyCode keycode, float delta);
void smallWalkRight();
void smallWalkLeft();
void walkRight();
void walkLeft();
void setViewpointCenter(Vec2 positon);
bool onContactBegin(PhysicsContact& contact);
bool onContactPreSolve(PhysicsContact& contact, PhysicsContactPreSolve& solve);
void onContactPostSolve(PhysicsContact& contact, const PhysicsContactPostSolve& solve);
void onContactSeparate(PhysicsContact& contact);
Vec2 tileCoordForPosition(const Vec2& position);
void updatewhenjump();
void playerdie();
void timer(float dt);
void updateStart(float dt);
void toEndingScene(float dt);
void toMainScene();
void toFinalPoint(float dt);
void toNextGame(float dt);
void menuCallBack(Ref* pSender);
void toFlag();
void enemyrun(Monster*szeName);
void enemydie(Sprite*Name);
protected:
cocos2d::CCTMXTiledMap *map;
cocos2d::TMXLayer *Land;
cocos2d::TMXLayer *Pipe;
cocos2d::TMXLayer *Coin;
cocos2d::TMXLayer *Block;
cocos2d::TMXLayer *Flag;
cocos2d::TMXLayer *Block_;
cocos2d::TMXLayer *Pipe_;
cocos2d::TMXLayer *Land_;
float final;
private:
time_t startTime;
Label* timerLabel;
MenuItemLabel* soundLabel;
MenuItemLabel* saveLabel;
Layer* timerLayer;
};