cocos2dx吧 关注:10,997贴子:33,681
  • 18回复贴,共1

新手求教啊。。

只看楼主收藏回复

各位大神,本人cocos新手,照着书上的大富翁游戏开始学着做,现在碰到问题了。。在游戏过程中直接关掉游戏就有如下提示
不知道问题出在哪里。。请各路大神赐教!


IP属地:北京1楼2016-05-25 14:40回复
    声明失败,ccnode这个文件193行,自己好好看一下


    来自Android客户端2楼2016-05-25 17:56
    回复
      #ifndef __GAME_BASE_SCENE_H__
      #define __GAME_BASE_SCENE_H__
      #include "cocos2d.h"
      #include "cocos-ext.h"
      #include "ConstUtil.h"
      #include "RicherPlayer.h"
      #include "RouteNavigation.h"
      #include "Util.h"
      #include <vector>
      #include "popupLayer\PopupLayer.h"
      #include "PopupLayer\CocosToast.h"
      #include "LanguageString.h"
      #include "prop\Strength_up.h"
      #include "prop\Bee.h"
      #include "prop\Fog.h"
      #include "prop\Stretcher.h"
      #include "prop\Emergency.h"
      #include "prop\Pearl.h"
      #include "lottery\LotteryCard.h"
      #include "stock/LineChart.h"
      #include "skill\SkillCard.h"
      #include "json/document.h"
      #include "json/writer.h"
      #include "json/stringbuffer.h"
      #include "string.h"
      USING_NS_CC;
      USING_NS_CC_EXT;
      using namespace rapidjson;
      const int tableStartPosition_x = 650;
      const int tableStartPosition_y = 450;
      const int tableWidth = 50;
      const int tableHeight = 40;
      const int tiledWidth = 32;
      const int tiledHeight = 32;
      const int goButtonTag = 700;
      const int skillButtonTag = 701;
      const int skillStormTag = 702;
      const int skillStepTag = 703;
      const int skillTransferTag = 704;
      const int saveButtonTag = 705;
      const int audioButtonTag = 706;
      const int backButtonTag = 707;
      const int stepBaseTag = 800;
      const int step1_tag = stepBaseTag + 1;
      const int step2_tag = stepBaseTag + 2;
      const int step3_tag = stepBaseTag + 3;
      const int step4_tag = stepBaseTag + 4;
      const int step5_tag = stepBaseTag + 5;
      const int step6_tag = stepBaseTag + 6;
      const int skillSpriteCardWidth = 150;
      const int skillSpriteCardHeight = 100;
      const float stepSkillAnimaTime = 0.1;
      const int _Quit_Dialog_Size_Width = 400;
      const int _Quit_Dialog_Size_Height = 220;
      const int _Btn_Quit_Game_TAG = 10004;
      const int _Btn_Quit_OK_TAG = 10005;
      const int _Btn_Quit_Cancel_TAG = 10006;
      const int _Btn_Width = 222;
      const int _Btn_Height = 50;
      class GameBaseScene: public Layer
      {
      public:
      static Scene* createScene();
      static TMXTiledMap* _map;
      virtual bool init();
      CREATE_FUNC(GameBaseScene);
      static int tiledColsCount;
      static int tiledRowsCount;
      static bool** canPassGrid;
      static TMXLayer* landLayer;
      static TMXLayer* wayLayer;
      std::vector<Vec2> wayLayerPass_vector;
      CC_SYNTHESIZE(Menu*, _menu, Menu);
      CC_SYNTHESIZE(LabelTTF *, player1_money_label, Player1_money_label);
      CC_SYNTHESIZE(LabelTTF *, player2_money_label, Player2_money_label);
      CC_SYNTHESIZE(LabelTTF *, player1_strength_label, Player1_strength_label);
      CC_SYNTHESIZE(LabelTTF *, player2_strength_label, Player2_strength_label);
      MenuItemImage* goMenuItemButton;
      int randStepsNumber;
      void setWayPassToGrid();
      //void onExit();
      void addGoButton();
      void menuButtonCallback(Object* pSender);
      void onReceiveCustomEvent(EventCustom* event);
      EventListenerCustom* customListener;
      RicherPlayer* player1;
      RicherPlayer* player2;
      static Vector<RicherPlayer*> players_vector;
      static Vector<Sprite*> pathMarkVector;
      static void drawPathColor(std::vector<int> rowVector, std::vector<int> colVector);
      static int blank_land_tiledID;
      static int strength_30_tiledID;
      static int strength_50_tiledID;
      static int strength_80_tiledID;
      static int randomEvent_tiledID;
      static int lottery_tiledID;
      static int stock_tiledID;
      static int player1_building_1_tiledID;
      static int player1_building_2_tiledID;
      static int player1_building_3_tiledID;
      static int player2_building_1_tiledID;
      static int player2_building_2_tiledID;
      static int player2_building_3_tiledID;
      int map_level;
      char* saveJsonName;
      bool reloadGame(int map_level);
      private:
      Size visibleSize;
      void drawTable(int playerNumber);
      void addPlayer();
      void addRightBanner();
      void addNotificationObserver();
      void receivedNotificationMsg(Object* data);
      void addDigiteRoundSprite();
      int gameRoundCount;
      Vector<SpriteFrame*> digiteRoundVector;
      Vector<Sprite*> refreshRoundVector;
      void refreshRoundDisplay();
      void addPathMark();
      PopupLayer* popDialog;
      void initPopDialog();
      void initLandLayerFromMap();
      int buy_land_x;
      int buy_land_y;
      void showBuyLandDialog(int landTag);
      void buyLandCallback(Node *pNode);
      void doSomeForParticle();//把动画相关的脚印精灵加载进来
      FadeOut* landFadeOut;
      FadeIn* landFadeIn;
      Sprite* foot1Sprite;
      Sprite* foot2Sprite;
      Sprite* starFish1Sprite;
      Sprite* starFish2Sprite;
      Sprite* heart1Sprite;
      Sprite* heart2Sprite;
      @夜战飞飞


      IP属地:北京4楼2016-05-25 22:41
      回复
        顶🔝


        IP属地:北京来自iPhone客户端7楼2016-05-31 01:39
        收起回复
          话说我也买了本大富翁的书。教程上的一些用法都是比较老的。最后面那个Jason存储一块处在问题。貌似不支持char*类型。之前我用3.6是能编译通过,用其他几个版本都编译不过。运行源码存在问题,需要自己修改下


          IP属地:广东8楼2016-07-23 14:32
          回复
            给你推荐一个群,在那里你会受益匪浅247260198


            IP属地:上海来自Android客户端9楼2016-07-23 21:06
            回复
              这是某一个节点读空了 或者找不到 你可以一段一段的注释掉直到能运行 然后找到那段有问题的地方用断点调试一下


              IP属地:广东来自Android客户端11楼2016-07-25 16:01
              回复
                你没办法确定是哪段代码出问题吗。可能是有资源没读到导致游戏没跑起来


                IP属地:福建来自iPhone客户端12楼2016-07-26 19:52
                回复
                  我曾经做游戏的时候遇到这种问题 关闭游戏就蹦 我的问题是在单例的释放上出的错 你可以检查一下所有的退出接口 估计是哪一个退出接口错的


                  IP属地:重庆13楼2016-07-27 11:27
                  回复
                    手机游戏开发吧


                    来自Android客户端14楼2019-04-28 07:00
                    回复