From 908d04438632ec308be1dd1e44208dc5375f2bde Mon Sep 17 00:00:00 2001 From: user666 Date: Mon, 1 Jul 2024 17:07:19 +0400 Subject: [PATCH] animated player replacement --- .../plr/plr_jumpdown_sheet/plr_jumpdown1.png | Bin 0 -> 292 bytes .../plr/plr_jumpdown_sheet/plr_jumpdown2.png | Bin 0 -> 314 bytes .../plr/plr_jumpdown_sheet/plr_jumpdown3.png | Bin 0 -> 278 bytes .../plr/plr_jumpup_sheet/plr_jumpup1.png | Bin 0 -> 270 bytes .../plr/plr_jumpup_sheet/plr_jumpup2.png | Bin 0 -> 279 bytes .../plr/plr_jumpup_sheet/plr_jumpup3.png | Bin 0 -> 273 bytes assets/visual/plr/plr_run_sheet/plr_run1.png | Bin 0 -> 845 bytes assets/visual/plr/plr_run_sheet/plr_run2.png | Bin 0 -> 789 bytes assets/visual/plr/plr_run_sheet/plr_run3.png | Bin 0 -> 889 bytes assets/visual/plr/plr_run_sheet/plr_run4.png | Bin 0 -> 872 bytes .../visual/plr/plr_stand_sheet/plr_stand1.png | Bin 0 -> 242 bytes .../plr/plr_stand_sheet/plr_stand10.png | Bin 0 -> 260 bytes .../visual/plr/plr_stand_sheet/plr_stand2.png | Bin 0 -> 243 bytes .../visual/plr/plr_stand_sheet/plr_stand3.png | Bin 0 -> 247 bytes .../visual/plr/plr_stand_sheet/plr_stand4.png | Bin 0 -> 246 bytes .../visual/plr/plr_stand_sheet/plr_stand5.png | Bin 0 -> 251 bytes .../visual/plr/plr_stand_sheet/plr_stand6.png | Bin 0 -> 253 bytes .../visual/plr/plr_stand_sheet/plr_stand7.png | Bin 0 -> 253 bytes .../visual/plr/plr_stand_sheet/plr_stand8.png | Bin 0 -> 260 bytes .../visual/plr/plr_stand_sheet/plr_stand9.png | Bin 0 -> 260 bytes mod.json | 12 ++ src/main.cpp | 127 +++++++++++++++++- 22 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown1.png create mode 100644 assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown2.png create mode 100644 assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown3.png create mode 100644 assets/visual/plr/plr_jumpup_sheet/plr_jumpup1.png create mode 100644 assets/visual/plr/plr_jumpup_sheet/plr_jumpup2.png create mode 100644 assets/visual/plr/plr_jumpup_sheet/plr_jumpup3.png create mode 100644 assets/visual/plr/plr_run_sheet/plr_run1.png create mode 100644 assets/visual/plr/plr_run_sheet/plr_run2.png create mode 100644 assets/visual/plr/plr_run_sheet/plr_run3.png create mode 100644 assets/visual/plr/plr_run_sheet/plr_run4.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand1.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand10.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand2.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand3.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand4.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand5.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand6.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand7.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand8.png create mode 100644 assets/visual/plr/plr_stand_sheet/plr_stand9.png diff --git a/assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown1.png b/assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown1.png new file mode 100644 index 0000000000000000000000000000000000000000..1a9b43e2517df26c914ddabd29af33dd6275ed52 GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^DL`Dx!3-q(w{3|4QbGYfA+A6g2xg@EJ}tK06rt3HQ6$BhEZrk?ze$l~>gMu}D7LWGY ztFb-*vDom3l9E!^mhId}-}ZV_`+uC%$72SqehZ-s_kGU7jRw+y5^} zKsCkK;P)#3eYTEM1S<9HBfbGmcG+~Y@^$qN1%6jPmZFOA4M+Gz1tv_Ja8y)b>x8%4 k8I!m*xf*V`bVR-9zqUup`mxv6Um(wVy85}Sb4q9e06aHq`~Uy| literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown2.png b/assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown2.png new file mode 100644 index 0000000000000000000000000000000000000000..8116b6e5248ea9cf926afd220cf1854162bcd093 GIT binary patch literal 314 zcmeAS@N?(olHy`uVBq!ia0vp^DL`Dx!3-q(w{3|4QbGYfA+A6g2xg@EJ}tK06rt@HsPGxr5M>iLjFYI@d74jyqcqm++$iy(SFNC4Pe~Br}Bksx;hd&C@9us~pENOBmPt{O}N(a?Q*)^iP@h&mrZEv*kjJPHGGAIvIp~#HzGlI?G(I~uCgEH zn{ct?*TJJR73Th%$6nYtL))QEIX)a{^EuhY+6<3`6{Gf=_ZUmPoA<@{JSYe}UHx3v IIVCg!0G9QB;Q#;t literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown3.png b/assets/visual/plr/plr_jumpdown_sheet/plr_jumpdown3.png new file mode 100644 index 0000000000000000000000000000000000000000..af5db89a0044b9770ba08c6b100fb94617e83195 GIT binary patch literal 278 zcmeAS@N?(olHy`uVBq!ia0vp^DL`Dx!3-q(w{3|4QbGYfA+A6g2xg@EJ}tK06rt*uMsiG=Z7R$sJHK2K zm?XHw!id>$k<&+(3Fnoy7dS3gceI&sdFvHEV@IBee{;VXOjtGHXOKX0isioj8}_{G zUwHO1&k>Hm-7Jsv6DIsuI61fP$u)M5yd$Zf<&NY{7h7U6X%6Eg*^hrRnOZtJ*3D+v X<0{?rFyzD+koP=Y{an^LB{Ts5a9C)1 literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_jumpup_sheet/plr_jumpup1.png b/assets/visual/plr/plr_jumpup_sheet/plr_jumpup1.png new file mode 100644 index 0000000000000000000000000000000000000000..c248d33bd4e81a35ab98d812f01a14520f04e3c8 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^DL`Dx!3-q(w{3|4Qv3lvA+A6g2xg@EJ}tK06rtPU zsdECzXDkWw3ubV5b|VeQS?lTI7*a9k?F~=91_c4uz~#T^-`o<|d`VD%rDfIJ8Gp8` z^0)xOmE6T*9)d2i{=AJYikEFClnLGpVw|AVv81nA#8pmlg3^hc62>PCD%MKYr{{I% zo>cTG?$}lN@(1H2=8X*L3JSG~4-as29Fg96-}TU^JwZ(=PE6~5DtuK;t9yLhTE&C! zi0;xVX*NzTvn_WwM=+?olDu0L=FiyBVA3+<{>p8RbuBeQ99M5~Eeev&@(lME26@ZV L)z4*}Q$iB}qUv97 literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_jumpup_sheet/plr_jumpup2.png b/assets/visual/plr/plr_jumpup_sheet/plr_jumpup2.png new file mode 100644 index 0000000000000000000000000000000000000000..337f4ef7825c196f8744e3aea8e417d36eaaf2ba GIT binary patch literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^DL`Dx!3-q(w{3|4Qv3lvA+A6g2xg@EJ}tK06rtPU zsdECzXDkWw3ubV5b|VeQ+2-lu7*a9k?agSe1_c3!i*di>i$zqeqE__szq#k%ZRscw zCM*a9e|JT)UE=xJHod`N(?nM`Bef!aJ|+det#vtX z-o&v;@=r9L`=(jJRN%ecezqVfPi6-%<(Cd@EJD2}_IgB3jP{z4^CYH2UT*(c_Lt&@ z+@G!fT_nDjru;fnw-gA41$S-hWk1Lb*`n4IozW0p3P UzR#>)a1i7_Pgg&ebxsLQ013}vA^-pY literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_jumpup_sheet/plr_jumpup3.png b/assets/visual/plr/plr_jumpup_sheet/plr_jumpup3.png new file mode 100644 index 0000000000000000000000000000000000000000..a1869829c4116c5ed822f7a18745c63283e6fa48 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^DL`Dx!3-q(w{3|4Qv3lvA+A6g2xg@EJ}tK06rtPU zsdECzXDkWw3ubV5b|VeQ+2HBo7*a9k?M+X<1_d66z~#T^-@LM7C7a+37597 zwGt2%6b#(nyUw9Y;oQS(0v;kpcbPNACr0`)EYbKR;URd0yD`OmNn|PG6DAdFrQ&I} zy}2h2BR01_q}8 zo-U3d6>)E8?=B2+6mS*iie_E+Xo5S(svr@G8!SrF%?v5Qt{fFNS`@^)SQ4IQwzvN> zuKj(sYxBF;_vies+Lc!Jz2E^eBZmV6lRyIlivj}y=DCIg-Nq{}MnB45|4@1N(`)~Y zHgd$Yun4$tmpuL|YR_4C5-@|*p`Sk7e{_n2K-;bSt zq~`xi?+VG|5{mPE`V1Lmg`C!zy9wAn4q#*9e0WJ(xno|T#$i2YTjL|nt8W?Hle+L& zppWn4%~{+2ycA%)+Bt*6h|&LHmjc%+VZ-J6hvka;+c#{SH@kbjuLQUI{nh8> znkK%J0m8o&It236Oqx8Qy+{z@(&V7D48|wtUG~7Z>e%V=F$PKYQoS-+J~Qmlb1QS$|gO5Du9x z*;F#I?AgTkozbOlJ|<_Y_X`^zeY!A|T{cNDtFBMs?18l<93bYt(>#{z4F9Z;?mk_p z7peB_vu)b32oc$&Q&+MZ6!z{po5PW$^vblt%-E%6?Oc9Yr640|F~?0$TebzT*> zbCCr{5X&Ylo~DqAI$g~Qt_rIUt!SHOs$=_gb=K!6_s+KQ-Q@jSmc-&X;V6er*g37~ x-T$BNxltv4W0Tlx0kCKQA0(MRm?`jsS-;q;;q`hhH(>r?@O1TaS?83{1OV09VQ&Bc literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_run_sheet/plr_run2.png b/assets/visual/plr/plr_run_sheet/plr_run2.png new file mode 100644 index 0000000000000000000000000000000000000000..fdb4a857e16c344afb161977ed7e6ae8208f87d2 GIT binary patch literal 789 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 literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand10.png b/assets/visual/plr/plr_stand_sheet/plr_stand10.png new file mode 100644 index 0000000000000000000000000000000000000000..70fc1a3dd42743d049437777143399ca40023fab GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa+Gk7srr_Id5-RiZv+kFa%!z9Uqz88aP4r$=Q;CC*rqS zIy*Wh%??%gtLW-7p~gdxLxnS{M8Q{J=2xx;6W2A3J>3?H6Vy(uG8VLK4skb|%Xvz2 ziPfhcAEa1TcG)mQD})N+666=m;PC7QNNK;Pi(^Q|oVPc2^ED{&I0VlB|NrzdW=>6~5HHT6_iW7R z30dMwn{q-MeY#8p9p4COb1dPyS)%Z+LnZ$%lS1so9EI2kN-Uq^Q?4KFnB#b7qO*8& z5nG}Ar2gv)9omx^b~-qyxymss2rI{{3QRaCXd9Axf1TuR2M0EHr;n$;@obG*+Puf< f)N}bP0l+XkKVRKQB literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand3.png b/assets/visual/plr/plr_stand_sheet/plr_stand3.png new file mode 100644 index 0000000000000000000000000000000000000000..f50e3d8a031c7952f7339b16a91cbb46250176d9 GIT binary patch literal 247 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa* zYvR&(Nx8X-X{N|arKTH-VFDh)n_fEH5%f$;Wt_0k!*GJ4hbYre{Y|fvT+S)HJF&3a z(Xx4m^2x*50!KtW8-f%RCM#`coX|OOyAa2T+666=m;PC7QNa-X`7srr_Id5<5=4(*kaR{9M|NrT>#wD6gJZn`??Um-S zW#-->Ffn~KS4z+mQNbhpADbL}E-Yh~Y+4ezo#8~l5~&jcOE??d6CXV=sgpS6}rUVTOBzsR^hJ4=i6c`JSR_9ru*ed kr8VD}_)U!i1Uk%%7&By~RwmdKI;Vst07CFqX#fBK literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand5.png b/assets/visual/plr/plr_stand_sheet/plr_stand5.png new file mode 100644 index 0000000000000000000000000000000000000000..d6be538a0dedcee3db49c0139e7abcd4943f4789 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa=J>7srr_Id5<5=4(*kaZ6nP{{N}AgDl-u)!?C`|vf p_pi==lXp!&6n?34fIx?N5rasw^s=M2>yLx{;OXk;vd$@?2>{ZuSCIe! literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand6.png b/assets/visual/plr/plr_stand_sheet/plr_stand6.png new file mode 100644 index 0000000000000000000000000000000000000000..fbdc6959a22d3a06fe866c17e2b00a47e0136d5d GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa;*Z7srr_Id5-R^ED_4Fa+-ZzJJpti5QoZ*47C#`JBFq zh8PG2o=g+u;P6oQ5EWb^6U4>zlU3Jff?CJyuN(~~u8SIby7xFK_)Z9Yrkux{)R$u< zUy?0Qtg@qmvuTDBqX732mY+NgJk2R**kRs^HTY0T7sAQpE6QmDII|)0#JdeBtTp=d#Wzp$P!OcT*|= literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand7.png b/assets/visual/plr/plr_stand_sheet/plr_stand7.png new file mode 100644 index 0000000000000000000000000000000000000000..fbdc6959a22d3a06fe866c17e2b00a47e0136d5d GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa;*Z7srr_Id5-R^ED_4Fa+-ZzJJpti5QoZ*47C#`JBFq zh8PG2o=g+u;P6oQ5EWb^6U4>zlU3Jff?CJyuN(~~u8SIby7xFK_)Z9Yrkux{)R$u< zUy?0Qtg@qmvuTDBqX732mY+NgJk2R**kRs^HTY0T7sAQpE6QmDII|)0#JdeBtTp=d#Wzp$P!OcT*|= literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand8.png b/assets/visual/plr/plr_stand_sheet/plr_stand8.png new file mode 100644 index 0000000000000000000000000000000000000000..4371bbe7f0269d30b2e4e4365a4c96317dfc0457 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa+Gk7srr_Id5-R@--+3I0Rn*9Uqy=!>6!`m+k+1g_Jl) zR$;-bIop_iYF^@D(sY{Dq40G=lz@lemJ<%U6w;=NGra6#VU`rHYyomtpK&`Qj?i{8};bP$bvlM>FVdQ&MBb@0B5;WfdBvi literal 0 HcmV?d00001 diff --git a/assets/visual/plr/plr_stand_sheet/plr_stand9.png b/assets/visual/plr/plr_stand_sheet/plr_stand9.png new file mode 100644 index 0000000000000000000000000000000000000000..70fc1a3dd42743d049437777143399ca40023fab GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^DIm+666=m;PC7QNa+Gk7srr_Id5-RiZv+kFa%!z9Uqz88aP4r$=Q;CC*rqS zIy*Wh%??%gtLW-7p~gdxLxnS{M8Q{J=2xx;6W2A3J>3?H6Vy(uG8VLK4skb|%Xvz2 ziPfhcAEa1TcG)mQD})NaddPriorityPath( (Mod::get()->getTempDir() / "resources" / "user95401.run_mod").string().data() ); - CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("typo_run_sheet.plist"_spr, "typo_run_sheet.png"_spr); - CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("tp_sheet.plist"_spr, "tp_sheet.png"_spr); } //tools @@ -261,7 +259,7 @@ class $modify(CCSpriteModExt, CCSprite) { #endif // 1 -//layers +//layers n objects #if 1 #include @@ -370,4 +368,127 @@ class $modify(CreatorLayerExt, CreatorLayer) { } }; +#include +class $modify(PlayerObjectExt, PlayerObject) { + struct Fields { + float m_lastPlatformerXVelocity = 0.1; + }; + bool isCube() { + auto player = this; + if (!player->m_isShip && !player->m_isBall && !player->m_isBird && !player->m_isDart && !player->m_isRobot && !player->m_isSpider && !player->m_isSwing) + return true; + return false; + } + void mySch(float) { + m_fields->m_lastPlatformerXVelocity = + fabs(this->m_platformerXVelocity) > 0.001f ? + this->m_platformerXVelocity : m_fields->m_lastPlatformerXVelocity; + auto mainLayer = this->getChildByIDRecursive("main-layer"); + auto plr_run = dynamic_cast(this->getChildByIDRecursive("plr_run")); + auto plr_jumpup = dynamic_cast(this->getChildByIDRecursive("plr_jumpup")); + auto plr_jumpdown = dynamic_cast(this->getChildByIDRecursive("plr_jumpdown")); + auto plr_stand = dynamic_cast(this->getChildByIDRecursive("plr_stand")); + if (plr_run and plr_jumpup and mainLayer) { + auto showplr = (this->isCube() or this->m_isRobot) and not this->m_isDead; + auto jmpup = not this->m_isOnGround and fabs(m_yVelocity) > 0.1f; + auto stand = this->m_platformerXVelocity == 0.f and this->m_isPlatformer; + auto goesLeft = m_fields->m_lastPlatformerXVelocity < 0.f and this->m_isPlatformer; + mainLayer->setVisible(not showplr); + ;;;;;; plr_run->setVisible(showplr and !jmpup and !stand); + ;;; plr_jumpup->setVisible(showplr and jmpup and m_yVelocity > 0.1f); + ; plr_jumpdown->setVisible(showplr and jmpup and m_yVelocity < -0.1f); + ;;;; plr_stand->setVisible(showplr and !jmpup and stand); + plr_run->setFlipX(goesLeft); + plr_jumpup->setFlipX(goesLeft); + plr_jumpdown->setFlipX(goesLeft); + plr_stand->setFlipX(goesLeft); + plr_run->setFlipY(this->m_isUpsideDown); + plr_jumpup->setFlipY(this->m_isUpsideDown); + plr_jumpdown->setFlipY(this->m_isUpsideDown); + plr_stand->setFlipY(this->m_isUpsideDown); + plr_run->setAnchorPoint(this->m_isUpsideDown ? CCPoint(0.5f, 0.66f) : CCPoint(0.5f, 0.43f)); + plr_jumpup->setAnchorPoint(this->m_isUpsideDown ? CCPoint(0.5f, 0.66f) : CCPoint(0.5f, 0.43f)); + plr_jumpdown->setAnchorPoint(this->m_isUpsideDown ? CCPoint(0.5f, 0.66f) : CCPoint(0.5f, 0.43f)); + plr_stand->setAnchorPoint(this->m_isUpsideDown ? CCPoint(0.5f, 0.66f) : CCPoint(0.5f, 0.43f)); + } + this->m_robotBurstParticles->setVisible(0); + this->m_iconSprite->setScale(1.f); + log::debug("{}->{}() m_yVelocity={}", this, __FUNCTION__, m_yVelocity); + } + void updateRotation(float p0) { + if (this->isCube()) { + this->m_isRobot = 1; + if (this->m_isOnGround) PlayerObject::updateRotation(p0); + this->m_isRobot = 0; + } + else PlayerObject::updateRotation(p0); + } + bool init(int p0, int p1, GJBaseGameLayer * p2, cocos2d::CCLayer * p3, bool p4) { + if (!PlayerObject::init( p0, p1, p2, p3, p4)) return false; + this->schedule(schedule_selector(PlayerObjectExt::mySch)); + auto plr_run = CCSprite::createWithSpriteFrameName("plr_run1.png"_spr); + if (plr_run) { + plr_run->setScale(1.4f); + plr_run->setID("plr_run"); + plr_run->setVisible(0); + this->addChild(plr_run); + //frames + auto frames = new CCArray; + for (int i = 1; i <= 4; i++) + frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fmt::format("plr_run{}.png"_spr, i).data())); + //animate + plr_run->runAction(CCRepeatForever::create(CCAnimate::create(CCAnimation::createWithSpriteFrames(frames, 0.04f)))); + }; + auto plr_stand = CCSprite::createWithSpriteFrameName("plr_stand1.png"_spr); + if (plr_stand) { + plr_stand->setScale(1.4f); + plr_stand->setID("plr_stand"); + plr_stand->setVisible(0); + this->addChild(plr_stand); + //frames + auto frames = new CCArray; + for (int i = 1; i <= 10; i++) + frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fmt::format("plr_stand{}.png"_spr, i).data())); + //animate + plr_stand->runAction(CCRepeatForever::create(CCAnimate::create(CCAnimation::createWithSpriteFrames(frames, 0.06f)))); + this->m_iconSprite->runAction(CCRepeatForever::create(CCAnimate::create(CCAnimation::createWithSpriteFrames(frames, 0.06f)))); + }; + auto plr_jumpup = CCSprite::createWithSpriteFrameName("plr_jumpup1.png"_spr); + if (plr_jumpup) { + plr_jumpup->setScale(1.4f); + plr_jumpup->setID("plr_jumpup"); + plr_jumpup->setVisible(0); + this->addChild(plr_jumpup); + //frames + auto frames = new CCArray; + for (int i = 1; i <= 3; i++) + frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fmt::format("plr_jumpup{}.png"_spr, i).data())); + //animate + plr_jumpup->runAction(CCRepeatForever::create(CCAnimate::create(CCAnimation::createWithSpriteFrames(frames, 0.06f)))); + }; + auto plr_jumpdown = CCSprite::createWithSpriteFrameName("plr_jumpdown1.png"_spr); + if (plr_jumpdown) { + plr_jumpdown->setScale(1.4f); + plr_jumpdown->setID("plr_jumpdown"); + plr_jumpdown->setVisible(0); + this->addChild(plr_jumpdown); + //frames + auto frames = new CCArray; + for (int i = 1; i <= 3; i++) + frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fmt::format("plr_jumpdown{}.png"_spr, i).data())); + //animate + plr_jumpdown->runAction(CCRepeatForever::create(CCAnimate::create(CCAnimation::createWithSpriteFrames(frames, 0.06f)))); + }; + updatePlayerFrame(1); + return true; + } + void updatePlayerFrame(int p0) { + PlayerObject::updatePlayerFrame(p0); + this->m_iconSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("plr_stand1.png"_spr)); + this->m_iconSpriteSecondary->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("emptyGlow.png")); + this->m_iconSpriteWhitener->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("emptyGlow.png")); + this->m_iconGlow->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("emptyGlow.png")); + } +}; + #endif // 1