Invert solid+8 direction behavior?

0 favourites
  • 8 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • I am wondering if this can done simply: I want to have the player only able to move around when on top of another sprite, and collide with the edge as if colliding with something solid. The sprite needs to be able to move around, so bordering the sprite with other solid sprites is out. (It might be possible but way to complicated to be practical)

    Is there some way to invert the solid/8 direction behavior in this way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If there isn't a way to do this I may have to delve into the custom movement behavior, but it's worth a shot. If I do, is there a custom movement already written that is similar to what I want, or like the 8 direction movement that I can then adapt instead of reinventing the wheel?

  • Just put invisible walls around the edge of the sprite you want the player to walk on :)

  • Thanks, but: " so bordering the sprite with other solid sprites is out"

    Already gave this idea plenty of thought. There are other reasons as well, which I won't go in to, but trust me, that option is out.

  • It occurs to me that I could use an inverted overlap condition; that then disables 8 direction, kicks you in reverse a little, then re-enables 8 direction.

    Any thoughts?

  • So the sprite underneath the player is moving about but the player can only move when on top of the sprite?

    If Player is overlapping sprite > Enable 8-direction

    else Disable 8-direction

  • I would have suggested the invisible walls too. Add Pin behaviors to those walls and pin them to the "container" sprite, so thqt when the sprite moves, the walls follow.

    Otherwise you can re-invent the wheel, testing on every click or when your character moves that it is contained inside the sprite and if not, repositioning the player

  • But then the player is stranded and can't move back onto the sprite. I am currently pursuing this as a possible solution, but I have two problems: 1) I'll have to code getting the player back onto the sprite as if bumping into the wall (which I can do) 2)The overlap doesn't trigger until the player is COMPLETELY outside (ie, not overlapping at all) the sprite. I need to figure out how to make it trigger earlier so that the player appears to be contained within the sprite. Not sure how to go about doing that yet. Maybe something involving image points.

    OlivierC Yes, I am aware of pinning and use that method to contain the player quite well in a different project. However, for reasons more complicated than I want to get into now, it is not a viable solution for this particular application. Just trust me on this.

    Yeah, I am aware of the danger of reinventing the wheel. Trying to avoid it. However, often I find that there are options and methods that I am not aware of that folks on this forum can point out.

    Thanks!

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