Issues with switching states

0 favourites
  • 8 posts
  • Hello All,

    After following instructions from Kyatric and keepee, I've created an 8 way directional control for a movement I'm trying to create. I've got it so that I'm charging a meter variable attached to the player and after releasing the "action" button J, the state for the player switches to an 8 way movement and has 0 gravity. However, it seems to have cancelled my jumping action and I'm not exactly sure why.

    I've tried separating the states into groups and reorganizing and everything else seems to be working fine, despite there being a slightly glitchy movement while the player is in platform state. I'm wondering if I could get some assistance.

    Here's the capx:

    dl.dropbox.com/u/65206613/TestPlatform.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I was actually following that particular part as a guide. There was also a wordpress tutorial for the same kind of concept. The problem is that everything switches states successfully, but my jump function is gone for some reason.

  • AH I found the reason. I didn't know that construct was incapable of switching behaviors on the fly. The two behaviors were conflicting and cancelling each other out. I think I'm going to try a spawn workaround. Thank you for the help though.

  • This should be what you want

    Using two behaviors on a single player sprite at the same time is not really advised.

    That's why the player was like hopping even if no key was touched.

    Once you disable the non used behavior, things look better.

    Also using groups (enabling/disabling them) helps to define precisely "states". Only the code in the activated group is executed.

    Also with common code, you can put it after the groups as to be executed each tick anyway.

    Let me know if you need more explanations.

  • Wow that definitely helped. I didn't know that you could enable and disable groups like that, so I didn't even think to do a workaround that way. I searched the other forums and there were some workarounds that used the 'pin' function, but I can't get that to work either. I'll play around with the enabling and disabling.

    Thank you!

  • Also, you disabled the currentmeter=100 when releasing j. I put this on as to have the full charge be the only time I switched states. Whenever I enable it, it doesn't seem to work anymore.

  • I tried using this technique for switching between the platformer behavior and the 8 way movement behavior, but am having trouble. I set up each behavior within a group and am trying to enable/disable groups based on a global variable called "PlayerState". When I run the program, all I get is a grey screen.

    I'm still pretty new so any help is greatly appreciated.

    Capx: dl.dropbox.com/u/56104169/State%20Change%20Test.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)