How do I make a 8-directional character face properly

0 favourites
  • 10 posts
From the Asset Store
2d mushroom sprite 2d game mushroom character enmy sprite game art
  • 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.

  • 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.


  • 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.

  • 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.

  • 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?

  • 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.

  • 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...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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!

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