Keeps on standing while "Duck is True"

Hi Fellas!

First, I've already search this topic on the previous threads but did not find any possible solution. Here is the problem, my actor/player keeps on standing even my Boolean "duck" state is true. BTW, I set it to be true thru collision event when the top of my actor was hit by a tile (the scenario is my character trying to pass a tunnel while ducking). To check their Boolean state I set draw the state so it can be clearly verified If the condition was followed, and it does. But the animation did not as it interchange simultaneously on true and false while in between two vertical tiles. And of course, it is false when I'm already out of the tunnel. Is there any possible way to resolve the issue?

Luyren

  • *
  • Posts: 2177
Video on non-collisions: https://youtu.be/e6vwZDSLxXg
The way you are using the otherwise on the collision event won't accomplish what you want. The video will explain what you should be doing instead.

As for actually preventing the stand up on crawl spaces, use a sensor collision box above your regular crouching collision box. If anything is colliding with it, prevent your actor from standing up. If you need info on multiple collision boxes, there is a video as well: https://youtu.be/TIGInUgT67A
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Hi Luyren,

Thanks for your advise and video links. Somehow I tried to follow your video but I can't state that I did it right but it looks like I manage to do what is needed maybe. There are still some glitches and instances on where my player came inside the debug line which is supposed to be solid (solid tile). I attached there the pics on my code blocks, maybe you can check if you have time. Btw, I used Jumping behavior to set my "Duck" boolean to false state.

Luyren

  • *
  • Posts: 2177
I can tell that your collision event won't work. You are checking if any actor of the group "Sensor" hits an actor of the group "tiles."

Use the first collision event (collides with anything)  and check if the group of colliding shape of the first actor is your sensor group, and if hits a tile. Then you can set it to true.

The do after at the bottom of your last update event should also be removed, just leave "Set Duck to false" without the do after, as the video explains.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Hi Luyren,

Thanks for taking your time to check my code, since I can't follow thru the idea using the first collision event it pushes me to use the Group to Group collision event instead, at which it produces some glitches and problem for me even it detects the collision. Hence, after watching your vids multiple times, I ended up reading the guides on stencylpedia and kaboooom! I now understand your words and translate it to code. And it Works! thanks a lot! It coz me three days for this.. ahahahah