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: Problem with actor.GoTo  (Read 3856 times)

0 Members and 1 Guest are viewing this topic.

Unmasked

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
    • View Profile
Problem with actor.GoTo
« on: February 24, 2006, 12:45:18 AM »

Hello!
Standart way to walk actor to point in scene is

on "LeftClick"
{
  actor.GoTo(Scene.MouseX, Scene.MouseY);
}

It's work nice.

Look at this code:

global last_mouse_click_x;
global last_mouse_click_y;

on "LeftClick"
{
  last_mouse_click_x=Scene.MouseX;
  last_mouse_click_y=Scene.Mousey;

  actor.GoTo(last_mouse_click_x, last_mouse_click_y);
}

Why it's not working? Please help me.
Logged

Columbo

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 33
  • Just one more thing...
    • View Profile
Re: Problem with actor.GoTo
« Reply #1 on: February 24, 2006, 05:13:10 AM »


global last_mouse_click_x;
global last_mouse_click_y;

on "LeftClick"
{
  last_mouse_click_x=Scene.MouseX;
  last_mouse_click_y=Scene.Mousey;

  actor.GoTo(last_mouse_click_x, last_mouse_click_y);
}

Why it's not working? Please help me.


I'm not a great scripter, but the only thing I can see that is maybe wrong is that the Scene.MouseY has the Y in lowecase, whereas the Scene.MouseX is in uppercase. Since your original code worked fine, I would say try just making Scene.MouseY with an uppercase Y. I don't know if this will help or even if the methods are case sensitive, but it's always worth a try. Maybe someone else knows why it's not working?  ???

The best way to troubleshoot this sort of thing is to write the values of the variables out in game.msg and see what is in each variable. If X is ok, but Y is not, then you know the Y variable is not being given a value, which is usually attributed to a typographical error. Good luck.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problem with actor.GoTo
« Reply #2 on: February 24, 2006, 07:55:09 AM »

Yes, Columbo is right. Change Mousey to MouseY and it should work. Method and attribute names in WME are case-sensitive.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Unmasked

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
    • View Profile
Re: Problem with actor.GoTo
« Reply #3 on: February 24, 2006, 10:03:09 AM »

Oh, of course! I'm an idiot! After midnight brain work not correct, so I made this mistake like a schoolboy. Thanks!
Logged

Columbo

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 33
  • Just one more thing...
    • View Profile
Re: Problem with actor.GoTo
« Reply #4 on: February 25, 2006, 03:41:04 AM »

I am so smart!  ;D
Logged
 

Page created in 0.021 seconds with 24 queries.