How do I make a 8-directional character face properly

Just started using Construct 2? Post your questions here

Post » Sun Mar 23, 2014 2:31 am

I have been reading these boards and I think have confused myself with all the old and new posts.

I have a character whose default position is facing right. I have figured out how to make the character moving and following the mouse. However, it looks stupid as he always faces the same way even if the enemies are behind, above or below.

At this point, I have created 4 animations and found code on the forum to choose (left, right, up, down) based on which direction he is moving. The problem is that the frame changes are very rough and choppy. Any advice on getting the smoother?

I ultimately want to make the enemies do the same thing... face the player when attacking but I am trying to get the player done first.
Last edited by nsalim on Mon Mar 24, 2014 2:44 am, edited 1 time in total.
B
3
Posts: 4
Reputation: 183

Post » Sun Mar 23, 2014 6:12 am

if it's a top down game, the 8-move behavior can be set to set angle to the way it's moving on the properties panel. You could also create an event where: every tick -> set angle to mouse x.y.

This is all terribly basic, i recommend that you read the manual and do the tutorials before taking any further step.

cheers.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sun Mar 23, 2014 5:28 pm

I am with you on the basics. The movements and having the character track the mouse on every tick is done and works as I expected.

The question I have not is the direction the sprite is facing. The image is a chicken that faces right all the time. Is there an efficient way of getting the character to face the direction of the angle it is going. At my experience level, I am thinking about using different animations or frames of one animation. I did that and it looks terrible when the character faces the new direction. I am asking for advice on how to make that a smother transition.
B
3
Posts: 4
Reputation: 183

Post » Mon Mar 24, 2014 12:17 am

I don't know man, can you describe the overall design of the game? is it a top down game, a platformer, isometric?
Depending on the view of the game, there are many different solutions you can use.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Mon Mar 24, 2014 1:21 am

Sure.... its a side-profile view like a platformer but no jumping and only one 1 screen. The player and all the opponents are free to move around the layout. The fact that the player has a face is the complication. The default view is that he is facing the right hand side. Since I choose the 8-directional behavior for the player, I would like him to face the direction he is going. Does that help?
B
3
Posts: 4
Reputation: 183

Post » Mon Mar 24, 2014 6:19 pm

B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Wed Mar 26, 2014 2:25 am

That totally helps.... and will work for now. I think I need to invest time in the animations of my character. Thanks for the tips and advice.
B
3
Posts: 4
Reputation: 183

Post » Wed Apr 02, 2014 7:52 am

Sorry to butt in but I have a similar problem - I'm making a top-down game that is keyboard controlled where the character will face the direction it is moving in (no problem with this part) but I am running into a problem where the character does not rotate to the correct facing once it is in contact with a collision enabled/solid object, it just ends up "strafing" along the wall instead.

i.e. Character is unable to rotate once in contact with a "wall"

Thanks for your help...
B
9
S
1
Posts: 12
Reputation: 616

Post » Thu Apr 03, 2014 1:49 am

First guess, is there is an event preventing the object to behave properly when in contact with the wall.
Sseconds guess is you made the base solid, and can't rotate because there is another solid object blocking it's path.

either way, @SECTORTWO, if it's not too much trouble, could you upload the capx so we can take a look at what might be wrong?
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Fri Apr 04, 2014 6:55 pm

Both the character sprite and the "wall" sprite were solid but removing the solid behaviour from the character sprite resulted in the same outcome.

I somehow finally managed to solve my issue by changing the character sprite to another image instead of the default blue triangle that the demo used (I am building upon the "aim spaceship at mouse" demo).

Thanks anyway!
B
9
S
1
Posts: 12
Reputation: 616


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest