Custom turn player before walking

Started by Mehrdad, Wed 04/03/2015 11:37:52

Previous topic - Next topic

Mehrdad

Hi

AGS have it in general settings but it use first frame from walk cycling in views and I really don't like it . I want make custom animations for turn player to another way.
Is it possible make custom turn player before walking for 8 direction ?
 
My official site: http://www.pershaland.com/

Ali

#1
I've searched, but I can't find the script I wrote several years ago.

From memory, this is how it worked:


  • On player click, get the player position and mouse position.
  • You can then get the difference between the X and Y values, say X= 100 and Y=-80 (if the player clicked up-right from the player.
  • Then you can use maths to work out the angle. Forgive me for not remembering the trigonometry. In this case it's 51 degrees up-right if facing right = 0/360 degrees.
  • Then you can choose the correct one of a number of pre-animated rotations to turn the character to face up-right from their current view.
  • Then make the character walk to the original click position

Point 4 has to be a blocking animation, which is one of the things that meant my script was never very elegant.

Mehrdad

Hi Ali

Thanks a lot for your help .I know you wrote it before but I don't know what was file name . I could found it in my archive . I uploaded it now for you :
https://www.dropbox.com/s/lhijdevvaohndtr/henry_8.zip?dl=0

It's very useful for me. I hope I can handle it for 8 direction as well as.

I'm appreciate Ali
My official site: http://www.pershaland.com/

Ali

There it is! Well discovered. There are some obvious problems with the calculations... good luck! Also, make sure to give all the Views 2 frames to get the diagonal loops to appear when walking.

Snarky

Would it be possible to have a separate view where all the "standing" frames are actually "turning" frames, and simply switch to that as the first thing you do when the character is supposed to walk? You might need one for clockwise and one for counterclockwise turns, but if your turn animation is simple, it might look OK, I think? (My only worry is that the turn might not respect the character animation speed, and perhaps would play too fast.)

Mehrdad

Hi
sorry to up old topic

I have a little problem with this example for turn character.

Everything is OK when I click in scene for Up/Down/Left/Right . But when I click in diagonal moves like Down-Right or Up-Left or... I have fine turn in the first but when character start to move he only choose  Up/Down/Left/Right and don't use diagonal view for walking .For example if i click South-East of character it start turn as correct direction but use Right or Down for walking and don't use Down-Right for walking.How can I get to fix it?
I sent PM for Ali and he was busy at the moment.
I'm Appreciate for any help because I'm working on animations and sheets now.
My official site: http://www.pershaland.com/

Ali

As mentioned in the post above, you'll have to give the walking animations 2 or more frames to see diagonal movement. This is an AGS thing, not an issue with this script. If you've already done this, then I'm not sure what the problem could be. As I said there are obvious glitches with the script. Feel free to use and adapt it as necessary, but I'm afraid at the moment I don't have time to offer proper support for it.

Mehrdad

Yes I knew and tried add frame before and it works fine.But turning have some another problems that I prefer don't speak about it now.
Thanks anyway Ali
My official site: http://www.pershaland.com/

Ali


SMF spam blocked by CleanTalk