资源简介
这个小程序自己写了,时间紧促,其中有不足之处,希望谅解,这个程序只是供大家学习用,开发环境是xcode cocos2d-x
代码片段和文件信息
//
// Gamelayer.cpp
// MyGoldMan
//
// Created by HeZhiTao on 13-11-2.
//
//
#include “Gamelayer.h“
#include “Data.h“
#include “Tools.h“
#include “GameWin.h“
#include “Shoplayer.h“
#include “GameOver.h“
#include “Messagelayer.h“
#include “MessageEnd.h“
Gamelayer::~Gamelayer()
{
miner->release();
hook->release();
}
CCScene* Gamelayer::scene()
{
CCScene* scene = CCScene::create();
Gamelayer* layer = Gamelayer::create();
scene->addChild(layer);
return scene;
}
bool Gamelayer::init()
{
if(!CClayer::init())
{
return false;
}
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
char tmp[50];
sprintf(tmp “mineBG%d.png“Level + 1);
CCSprite* sprite = CCSprite::create(tmp);
sprite->setPosition(ccp(winSize.width/2 winSize.height/2));
this->addChild(sprite -1);
// //添加炸弹
// CCSprite* boom = CCSprite::create(“boom.png“);
// boom->setPosition(ccp(240100));
// this->addChild(boom);
//添加钩子
hook = new Hook();
hook->setPosition(ccp(winSize.width/2-2 winSize.height/2-20));
this->addChild(hook);
hook->runRotateAction();
//添加矿工
miner = new Miner();
miner->setPosition(ccp(winSize.width/2 winSize.height/2));
// miner->runStayguyAction();
this->addChild(miner);
//添加黄金
ItemUnitArray = CCArray::create();
ItemUnitArray->retain();
this->addItem();
//添加时钟图标
alarmClockSprite = CCSprite::create(“clockPlate.png“);
alarmClockSprite->setPosition(ccp(380 260));
this->addChild(alarmClockSprite);
sprintf(tmp “%d“TotalTime[Level]);
alarmClockLB = CCLabelTTF::create(tmp “Zapfino“ 16);
alarmClockLB->setPosition(ccp(420 250));
alarmClockLB->setColor(ccc3(0 0 255));
this->addChild(alarmClockLB);
//添加级别图标
levelNumberSprite = CCSprite::create(“miner_0707.png“);
levelNumberSprite->setPosition(ccp(380 300));
this->addChild(levelNumberSprite);
sprintf(tmp “%d“Level);
levelNumberLB = CCLabelTTF::create(tmp “Zapfino“ 16);
levelNumberLB->setPosition(ccp(420 290));
levelNumberLB->setColor(ccc3(0 0 255));
this->addChild(levelNumberLB);
//添加分数图标
totalSocreSprite = CCSprite::create(“rmbImage.png“);
totalSocreSprite->setPosition(ccp(50 255));
this->addChild(totalSocreSprite);
sprintf(tmp “%d“ TotalSocre);
totalSocreSpriteLB = CCLabelTTF::create(tmp “Zapfino“ 16);
totalSocreSpriteLB->setPosition(ccp(110 250));
totalSocreSpriteLB->setColor(ccc3(0 0 255));
this->addChild(totalSocreSpriteLB);
//添加目标分数
goalNumberSprite = CCSprite::create(“Gold.png“);
goalNumberSprite->setPosition(ccp(50 290));
this->addChild(goalNumberSprite);
sprintf(tmp “%d“ NeedTotalScore[Level]);
goalNumberSpriteLB = CCLabelTTF::create(tmp “Zapfino“ 16);
goalNumberSpriteLB->setPosition(ccp(110 290));
goalNumberSpriteLB->setColor(ccc3
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-11-04 15:35 MyGoldMan\
文件 6148 2013-11-04 20:17 MyGoldMan\.DS_Store
目录 0 2013-11-12 08:31 __MACOSX\
目录 0 2013-11-12 08:31 __MACOSX\MyGoldMan\
文件 82 2013-11-04 20:17 __MACOSX\MyGoldMan\._.DS_Store
目录 0 2013-11-11 11:43 MyGoldMan\MyGoldMan\
文件 6148 2013-11-02 11:58 MyGoldMan\MyGoldMan\.DS_Store
目录 0 2013-11-12 08:31 __MACOSX\MyGoldMan\MyGoldMan\
文件 82 2013-11-02 11:58 __MACOSX\MyGoldMan\MyGoldMan\._.DS_Store
目录 0 2013-11-07 20:27 MyGoldMan\MyGoldMan\Classes\
文件 1807 2013-11-07 20:27 MyGoldMan\MyGoldMan\Classes\AppDelegate.cpp
目录 0 2013-11-12 08:31 __MACOSX\MyGoldMan\MyGoldMan\Classes\
文件 171 2013-11-07 20:27 __MACOSX\MyGoldMan\MyGoldMan\Classes\._AppDelegate.cpp
文件 1142 2013-11-02 11:57 MyGoldMan\MyGoldMan\Classes\AppDelegate.h
文件 171 2013-11-02 11:57 __MACOSX\MyGoldMan\MyGoldMan\Classes\._AppDelegate.h
文件 692 2013-11-11 11:39 MyGoldMan\MyGoldMan\Data.h
文件 171 2013-11-11 11:39 __MACOSX\MyGoldMan\MyGoldMan\._Data.h
文件 14508 2013-11-11 09:17 MyGoldMan\MyGoldMan\Gamela
文件 171 2013-11-11 09:17 __MACOSX\MyGoldMan\MyGoldMan\._Gamela
文件 2020 2013-11-07 15:07 MyGoldMan\MyGoldMan\Gamela
文件 171 2013-11-07 15:07 __MACOSX\MyGoldMan\MyGoldMan\._Gamela
文件 2150 2013-11-06 15:06 MyGoldMan\MyGoldMan\GameOver.cpp
文件 171 2013-11-06 15:06 __MACOSX\MyGoldMan\MyGoldMan\._GameOver.cpp
文件 427 2013-11-06 10:33 MyGoldMan\MyGoldMan\GameOver.h
文件 171 2013-11-06 10:33 __MACOSX\MyGoldMan\MyGoldMan\._GameOver.h
文件 1734 2013-11-06 10:01 MyGoldMan\MyGoldMan\GameWin.cpp
文件 171 2013-11-06 10:01 __MACOSX\MyGoldMan\MyGoldMan\._GameWin.cpp
文件 415 2013-11-06 09:53 MyGoldMan\MyGoldMan\GameWin.h
文件 171 2013-11-06 09:53 __MACOSX\MyGoldMan\MyGoldMan\._GameWin.h
文件 2466 2013-11-07 12:16 MyGoldMan\MyGoldMan\Hook.cpp
文件 171 2013-11-07 12:16 __MACOSX\MyGoldMan\MyGoldMan\._Hook.cpp
............此处省略1352个文件信息
相关资源
- 炸弹人(cocos2d-x 3.2)
- Cocos Creator 实现的超级玛丽小游戏de
- Xcode 12.2 (16E226) 真机调试包16E227可
- Desgin Patterns by Tutorials v1.0 (Swift 4 &
- cocos2dx经典三消游戏
- cocos2dx-3.0正式版源代码+完整资源 微信
- 让Xcode支持iOS11.4 Beta设备真机测试
- Cocos2d-x 瓦片地图操作Demo-双指缩放、
- xxtea加解密工具win32
- Cocos2D游戏之旅六:流星、烟花、火焰
- Cocos2dx游戏源代码《萝莉快跑》
- cocos2d-x游戏源码236061
- Swift语言实战晋级-课件代码源文件(
- 公司年会抽奖程序
- cocos2d-x 别踩白块源码
- Cocos2dx入门初级教程
- cocos2dx 3.3 跑酷游戏源代码和资源
- iPhoneOS12.1.sdk,低版本xcode不能编译程
- ios仿微信源码
- 仿网易新闻IOS客户端源码
- 捕鱼达人,xcode9.4.1 编译通过
- 捕鱼达人.zip
- 萝莉快跑2013
- cocos creator 开心消消乐
- 三国跑酷cocos2dx3.2源码
- Cocos2d-x《大抗战》塔防射击游戏源代
- richer单机完毕源码
- 连连看 cocos2dx 源代码
- 基于cocos开发的飞机大战含素材资源
- cocos2dx 大鱼吃小鱼游戏源代码
评论
共有 条评论