Character with a Dash can dash into walls, how do I prevent that?

HaleStorm7

  • Posts: 3
Hello, I am quite new to Stencyl and still learning. I have an issue with the game i'm creating and would like some help.
My game is a standard platformer focused around mobility so my character has a jump, a vertical dash and a horizantal dash. To execute the dashes I use the command "set x/y to x/y of Self - 200 for Self".
The dashes work perfectly except for one problem, I can dash through walls or into walls and get my character stuck.
Is there anyway I can prevent this or even stop the dash in front of the wall?
Thank you

Luyren

  • *
  • Posts: 2384
You are setting the position directly, meaning your actor is not moving towards anything, it's more like it is teleporting. You want to set its speed instead, or push it towards the desired direction.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

HaleStorm7

  • Posts: 3
I'm sorry, it doesn't seem to work. When I set a speed or push my actor in a x direction, nothing happens, my character won't dash like he is supposed to. Any idea why? I can provide you with some screenshots if you would like.
Edit: when I set a x speed/velocity to my actor he moves only slightly in the direction I want him to. I would like to make him move much further but using bigger values doesn't change it at all.
If you have an example so I can compare with what I have done would be really good too.

« Last Edit: October 17, 2020, 11:25:31 am by HaleStorm7 »

Luyren

  • *
  • Posts: 2384
Two things. Either:
1) Friction is getting in the way when dashing on ground, in which case: https://youtu.be/97M4hchcfwI
2) or your walking behavior has slowdown code built in that's stopping your actor. You need to disable that behavior for the duration of your dash, and enabled it when the dash is completed or interrupted.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

HaleStorm7

  • Posts: 3
I solved it! It was because of a slowdown code like you said. Thank you very much! Thanks to you I can now finalize my project. Have a good day!