Actor-tile side collision

rushgames

  • Posts: 6
I have an actor that is constantly moving to the right at a speed of 15 (shown in pic). It moves on top of platforms, however there are breaks in the platforms and they vary in height so that the actor must jump up to get to the next platform. The issue is, if the actor hits the side of a platform instead of landing on top, the actor stops and appears "stuck" on the side of the platform because its supposed to constantly move to the right, but it can't because the platform is in the way. I want the actor to fall off screen when it hits the side of a platform instead of landing on top, however I am having trouble implementing this idea. Can anyone help me solve this issue? Thank you.


Epic428

  • Posts: 1118
it would be helpful to know where that behavior above is being attached. If its to the actor that is moving to the *right* then why would you be checking if it was hit on the *Left*? Shouldn't you check to see if it was hit on the right? And the otherwise if block really isn't necessary if you've already set the actor speed elsewhere.

Also that collision check should be done using a collision event not the always event.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

rushgames

  • Posts: 6
The event is on the actor. I essentially wanted it to say "if the left side of the tile was hit," then apply the code to "self," meaning the actor that the code is attached too. I can't simply check if the actor is hit on the right side by just anything because the actor will be collecting coins, so anytime the actor collects a coin, the actor will fall off stage. I set the actor's speed in the pic I posted; its all a part of the same event.

I figured it made sense to have the speed and collision test in the same event because its an if/ else case... Like IF the actor hits the left side of the tile, THEN set y-speed to -10; OTHERWISE, continue moving to the right at a speed of 15.

Photon

  • Posts: 2697
If the coins are sensors, side-collisions don't apply and the coins won't fire off the event.

I actually would recommend that you kill the actor when it hits a wall and spawn a special "death actor" that carries out the death sequence/animation/etc. That way you don't have to deal with pesky nuances like disabling input and when its done, you simply spawn the player actor back in the place you want it to be.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

Epic428

  • Posts: 1118
collision blocks also can't be used in the "always" wrapper. They have to be used under the "when colliding". You can go with photons method, or if you don't want to, you can have the coins register the collision and be "collected". You could also have the player actor do the same. If you want to filter out what collisions are okay and what ones will cause the player to fall in a pit and die, use collision groups. Every time a collision registers, check to see what group the colliding object is. If its something that is okay to collect then don't respond, but if not, then set the actor's y speed to what you want.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

rushgames

  • Posts: 6
Alright guys, thank you for the responses! I'll let y'all know how it goes.