Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: valter.home on October 08, 2015, 04:11:32 PM

Title: on LeftDoubleClick
Post by: valter.home on October 08, 2015, 04:11:32 PM
Hello everybody, I would like to know if this is the correct way to proceed.
The character walking with left click but runs with the double left click.
At the moment I just move it without animation.
If in game.script simply I insert the code:

on "LeftDoubleClick"
{
    actor.SkipTo (Game.MouseX, Game.MouseY);
}

the character moves to the mouse but immediately after comes back and starts walking because it probably runs on "LeftClick"
If you use:

on "LeftDoubleClick"
{
    actor.SkipTo (Game.MouseX, Game.MouseY);
    actor.Reset ();
}

the character is not coming back.
Is this the right way to write this code?

Thank you

Valter
Title: Re: on LeftDoubleClick
Post by: eborr on October 10, 2015, 12:38:59 AM
Hello Valter you are using the wrong command for "Walking" you need to use GoTo check the scripting reference under actor.

SkipTo is more a teleport than a move
Title: Re: on LeftDoubleClick
Post by: valter.home on October 10, 2015, 07:49:09 AM
Hello Eborr , thanks for your answer.
I explained myself badly, I know the difference between GoTo () and SkipTo ().
Forget what I said about the run.
If I want to move the character without walking using SkipTo() in on "LeftDoubleClick" event the character jumps to the coordinates of the mouse but immediately reappears where it started and walking the same path. I think that happens so because run the event on "LeftDoubleClick" but also on "LeftClick". Am I wrong?
If after SkipTo()  I write actor.Reset() the character stays in place.
Title: Re: on LeftDoubleClick
Post by: anarchist on October 10, 2015, 11:09:19 PM
To make sure, first try using the Debug(); command in LeftClick event to see if its code runs together with LeftDoubleClick.
Title: Re: on LeftDoubleClick
Post by: valter.home on October 11, 2015, 05:01:12 PM
Thanks, I did not know yet that way, I'm studying  :)