# How do I Rotate 8Directional movement against Solid Objects

Just started using Construct 2? Post your questions here

### » Tue Feb 09, 2016 7:54 am

Howdy!

I've recently picked up Construct again to fidget with it, despite owning it for a while I never really decided to -DO- anything with it at all.. And had figured that replicating the combat from Oracle of Ages/Seasons would be a fitting challenge to get started with a new system. (Bear in mind, while I have little experience with Construct itself I have dabbled in the logic of game creation for a while, I might not be an expert but I do have some experience.)

The result is as follows: https://dl.dropboxusercontent.com/u/711 ... index.html
(Arrow keys to move, Control to attack. Spin charge works. You can't die, but the enemies can)

I've hit a bit of a wall (pun intended) though. the 8Directional movement Behaviour (using a 90 degree angle shift, not full rotation) does not rotate when the object is against a solid. And while I partially understand why it doesn't rotate (as it rotates, and doesn't just snap into an angle internally) I can't say it is the behaviour I want to see, as my animation depends on this angle.

Is there a way to make it rotate when another side is against a wall, or am I better off adding custom movement behaviour and fidgeting with this to get it to work my way?
B
5
S
1
Posts: 43
Reputation: 461

### » Tue Feb 09, 2016 4:36 pm

I played it for a bit (longer than I should have....) It looks and feels right to me. I tried to get it to get weird against objects but it functioned like I thought it should for a N,S,E,W control. What am I missing?
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
79
S
22
G
8
Posts: 649
Reputation: 10,253

### » Tue Feb 09, 2016 4:49 pm

When facing in a direction that is at a 90 degree angle from a wall while against it, and then walking INTO said wall the 8Directional movement object doesn't appear to rotate properly, causing this to happen:

I'm walking to the left, but because it never seems to rotate the animation played isn't set to the right direction. It's not that my events don't catch it, as there's situations for both moving and not moving.

Or perhaps I am missing something here?

(PlayerController is an invisible object that the object Link pins to, it's just a sprite with animations and no logic)
B
5
S
1
Posts: 43
Reputation: 461

### » Tue Feb 09, 2016 8:03 pm

The 8direction behavior only sets the angle when moving. What you want to do is set the angle based on what arrows are pressed.

https://dl.dropboxusercontent.com/u/542 ... angle.capx
B
98
S
36
G
132
Posts: 5,523
Reputation: 84,009

### » Tue Feb 09, 2016 8:23 pm

That was part of an assumption I made, and it unfortunately seems to be true. I suppose it's an easy fix then, set the angle when a button is pressed.

Much appreciated.
B
5
S
1
Posts: 43
Reputation: 461