Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Start walk animation on releasing the mouse button  (Read 3293 times)

0 Members and 1 Guest are viewing this topic.

Purpur

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 10
    • View Profile
Start walk animation on releasing the mouse button
« on: December 09, 2012, 05:50:39 PM »

Hi there!

On the basis of sundry problems with our gameplay, i got a question again.

At the moment it's the case that characters start walking immediately when clicking the left mouse button.
That's logical.
But wouldn't it be possible as well to let him start walking right on release? If so, how do i do that?

Thanks in advance!
Logged

ciberspace

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 116
    • View Profile
    • Tele Juego
Re: Start walk animation on releasing the mouse button
« Reply #1 on: December 10, 2012, 10:59:02 AM »

in scripts/game.script

on "RightClick"
{
  // if inventory item selected? deselect it
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
    return;
  }

  var ActObj = Game.ActiveObject;

  // is the righ-click menu visible? hide it
  if(WinMenu.Visible == true) WinMenu.Visible = false;
  else if(ActObj!=null)
  {
    // if the clicked object can handle any of the "verbs", display the right-click menu
    if(ActObj.CanHandleEvent("Take") || ActObj.CanHandleEvent("Talk") || ActObj.CanHandleEvent("LookAt"))
    {
      // store the clicked object in a global variable MenuObject
      MenuObject = Game.ActiveObject;
      var Caption = WinMenu.GetControl("caption");
      Caption.Text = MenuObject.Caption;

      // adjust menu's position
      WinMenu.X = Game.MouseX - WinMenu.Width / 2;
      if(WinMenu.X < 0) WinMenu.X = 0;
      if(WinMenu.X+WinMenu.Width>Game.ScreenWidth) WinMenu.X = Game.ScreenWidth-WinMenu.Width;

      WinMenu.Y = Game.MouseY - WinMenu.Height / 2;
      if(WinMenu.Y<0) WinMenu.Y = 0;
      if(WinMenu.Y+WinMenu.Height>Game.ScreenHeight) WinMenu.Y = Game.ScreenHeight-WinMenu.Height;

      // and show the right-click menu
      WinMenu.Visible = true;

      // stop the actor from whatever he was going to do
      actor.Reset();
    
    }
    // no verbs supported, no menu is needed; just send the RightClick event to the object
    else ActObj.ApplyEvent("RightClick");
  }
Scene.ApplyEvent("RightClick");
}

and scripts/scene.script
Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. ////////////////////////////////////////////////////////////////////////////////
  4. on "LeftClick"
  5. {
  6.   // when the scene is left-clicked, just send the actor to the specified point
  7. }
  8. on "RightClick"
  9. {
  10.   // when the scene is Right-clicked, just send the actor to the specified point
  11. }
« Last Edit: December 19, 2012, 10:53:37 AM by ciberspace »
Logged

ciberspace

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 116
    • View Profile
    • Tele Juego
Re: Start walk animation on releasing the mouse button
« Reply #2 on: December 10, 2012, 02:10:58 PM »

in scripts/game.script

Code: WME Script
  1. on "RightRelease"
  2. {
  3.  Scene.ApplyEvent("RightRelease");
  4. }

and scripts/scene.script
Code: WME Script
  1. on "RightRelease"
  2. {
  3.   // when the scene is Right-clicked, just send the actor to the specified point
  4. }
« Last Edit: December 19, 2012, 10:52:55 AM by ciberspace »
Logged
 

Page created in 0.052 seconds with 25 queries.