Invert solid+8 direction behavior?

Get help using Construct 2

Post » Wed Sep 25, 2013 12:52 am

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?
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Sep 25, 2013 1:02 am

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?
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Sep 25, 2013 3:06 am

Just put invisible walls around the edge of the sprite you want the player to walk on :)
B
46
S
14
G
7
Posts: 603
Reputation: 8,116

Post » Wed Sep 25, 2013 4:40 am

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.Yttermayn2013-09-25 14:04:03
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Sep 25, 2013 2:54 pm

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?
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Sep 25, 2013 3:44 pm

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
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Wed Sep 25, 2013 3:47 pm

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
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Wed Sep 25, 2013 7:21 pm

@plinkie 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!
B
11
S
4
G
1
Posts: 159
Reputation: 1,803


Return to How do I....?

Who is online

Users browsing this forum: David181, yiuyiu6666 and 27 guests