66/* *
77 * Brings cocos2d and all Geode namespaces to the current scope.
88 */
9+
910using namespace geode ::prelude;
1011static bool g_levelLocked = false ;
12+ int g_attemptcount = 0 ;
1113#include < Geode/modify/PlayerObject.hpp>
1214#include < Geode/modify/PlayLayer.hpp>
15+ #include < Geode/binding/LevelTools.hpp>
16+ #include < Geode/binding/GameManager.hpp>
1317class $modify(MyPlayerObject, PlayerObject) {
1418 void playerDestroyed (bool p0) {
15- PlayerObject::playerDestroyed (p0);
19+ auto gm = GameManager::get ();
20+ auto playLayer = PlayLayer::get ();
21+ if (g_attemptcount<=9 ) {
22+ log::debug (" test" );
23+ g_attemptcount++;
24+ } else {
25+ PlayerObject::playerDestroyed (p0);
1626
17- g_levelLocked = true ;
27+ g_levelLocked = true ;
1828
19- auto playLayer = PlayLayer::get ();
20- if (playLayer) {
21- playLayer->removeFromParentAndCleanup (true );
22- CCDirector::sharedDirector ()->replaceScene (MenuLayer::scene (false ));
23- PlatformToolbox::showCursor ();
24- PlatformToolbox::toggleLockCursor (false );
25- }
29+ if (playLayer) {
30+ playLayer->removeFromParentAndCleanup (true );
31+ CCDirector::sharedDirector ()->replaceScene (MenuLayer::scene (false ));
32+ PlatformToolbox::showCursor ();
33+ PlatformToolbox::toggleLockCursor (false );
34+ g_attemptcount = 0 ;
35+ }
36+ }
2637 }
2738};
2839#include < Geode/modify/MenuLayer.hpp>
@@ -36,12 +47,7 @@ class $modify(MyMenuLayer, MenuLayer) {
3647 auto menu = this ->getChildByID (" main-menu" );
3748 auto createmenu = this ->getChildByID (" main-menu" );
3849 if (menu) {
39- auto playBtn = menu->getChildByID (" play-button" );
4050 auto createBtn = menu->getChildByID (" editor-button" );
41- if (playBtn) {
42- playBtn->setVisible (false );
43- menu->updateLayout (true );
44- }
4551 if (createBtn) {
4652 createBtn->setVisible (false );
4753 menu->updateLayout (true );
0 commit comments