Analog stick controls and collision

0 favourites
  • 1 posts
From the Asset Store
This is a twin stick shooter similar to Enter the gungeon,Nuclear Throne, Helldivers & Soul knight for the mobile device
  • Howdy.

    So, I have a player character I'd like to move with a gamepad analog stick, and a bunch of objects in my level that I'd like to collide with. The first part is easy enough -- my player sprite has a Bullet behaviour, and on every tick I set its angle and velocity according to the left analog stick. The problem arises when colliding with a Solid, because even though "Bounce off solids" is set to "Yes", the sprite happily sails through any walls in its way. (I assume it's because even if the sprite "bounces", the velocity changes get overriden on the very next frame.)

    I also tried adding a Custom movement to the player sprite and just have it Push out solid any time it collides. The problem with that is that I'm importing my solids from a tilemap, so the walls I'm colliding with are actually composed of many smaller blocks. What I think ends up happening is that the behaviour picks the wrong solid to push out of, and I get weird movement artifacts (player sprite accelerating or getting stuck in place when pushing against a wall, jittering in corners, or sometimes the sprite gets warped to the other side -- depending on which variant of Push out solid is chosen).

    I don't have these collision issues when using 8-direction movement, but that would defeat the entire purpose of the analog stick.

    If anyone came across the same issue and found a way around it, I'd much appreciate any advice.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)