Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: beginner questions  (Read 4418 times)

0 Members and 1 Guest are viewing this topic.

DjPoke

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • View Profile
beginner questions
« on: September 13, 2013, 09:17:27 AM »

Hello to all,

I've a few question please :

1) When my character goto an other Scene, how can i tell him he must appear at a starting point or an other, depending on the old Scene he come from ?

2) Is it possible to make the character seek the mouse pointer while the "MouseDown" event is pressed ? In case of it is possible, what script should i edit ?
Logged

dongo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 29
    • View Profile
Re: beginner questions
« Reply #1 on: September 13, 2013, 12:21:29 PM »

1 - you can use the method actor.SkipTo(Pos X, pos Y);  Put this in the scene_init.script of the scene where you need to place the actor. if depend of the position on the scene before, you can use global variables... you can declare this on base.script with reserved word "global" and then you can use this variables in all the scripts of your game.

For example: if you have two entity doors in a scene called room, in the door1.script you put something like this:

Code: [Select]
on "LeftClick"
{
      output="door1";
      Game.ChangeScene("Scene2.scene);
}

in the door2.script:

Code: [Select]
on "LeftClick"
{
     output="door2";
     Game.ChangeScene("scene2.scene");
}

in base.script:

Code: [Select]
global output;

and in scene2_init.script:

Code: [Select]

switch(output){
     case "door1":{
          actor.SkipTo(pos x1,pos y1);
          break;
     }
     case "door2":{
          actor.SkipTo(pos x2,pos y2);
          break;
     }
}

2 - this is more complicated, you must to create a script, and attach to scene where you like to move your actor while press LeftClick. In this script you put something like  this.... To attach the script, go to scene edit, click on properties and clic on Scripts button, here you can create a new script for the scene.

Code: [Select]
var IsMoving=false;
on "LeftClick"
{
IsMoving=true;
while(IsMoving){
 
actor.GoTo(Scene.MouseX, Scene.MouseY);
Sleep(2);
}
}
on "LeftRelease"
{
IsMoving=false;
}

 

Recommendation: read the wme book online http://res.dead-code.org/doku.php/wmebook:start this help me a lot at start with wme
« Last Edit: September 13, 2013, 01:01:37 PM by dongo »
Logged

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: beginner questions
« Reply #2 on: September 13, 2013, 01:59:34 PM »

dongo has explained it perfectly, anyway if you only want to know from which scene are you coming from you can also use the Game.PrevScene.
Logged

NAItReIN

  • Occasional poster
  • **
  • Karma: 1
  • Offline Offline
  • Posts: 69
    • View Profile
Re: beginner questions
« Reply #3 on: September 13, 2013, 03:10:03 PM »

Quote
1) When my character goto an other Scene, how can i tell him he must appear at a starting point or an other, depending on the old Scene he come from ?

dongo post a piece of code but there is also any way how tell actor where he should stand depending on the previous scene.

There is the solution for you. It is copied from WME Demo 3D.

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. // here comes the stuff which initializes the scene
  4.  
  5. switch(Game.PrevScene)
  6. {
  7.         case "Menu":
  8.     actor.SkipTo(190, 480);
  9.     actor.Direction = DI_DOWNRIGHT;
  10.     // Game.Msg("Press F1 to show or hide the scene geometry.");
  11.     // Game.Msg("");
  12.     // Game.Msg("Press and hold the left mouse button to display the action menu.");
  13.     break;
  14.  
  15. case "Back alley":
  16.     actor.SkipTo(630, 482);
  17.     actor.Direction = DI_DOWNRIGHT;
  18.     break;
  19. }
Logged

dongo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 29
    • View Profile
Re: beginner questions
« Reply #4 on: September 13, 2013, 03:37:27 PM »

ok, correct jose and NAItReIN. i think only with a room with 2 outputs to other scene, but if the start point depend of what is the previous scene, you can use Game.PrevScene this atribute say you what is the previous scene where actor came.

thanks for the advice, i understand bad the first question  and sorry for my english too ;D 
« Last Edit: September 13, 2013, 03:39:16 PM by dongo »
Logged

DjPoke

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • View Profile
Re: beginner questions
« Reply #5 on: September 15, 2013, 02:38:24 PM »

Thanks a lot  :)
Logged
 

Page created in 0.049 seconds with 20 queries.