Yup, thanks--just don't know what to do here--I'm trying to follow the tutorial and am now up to giving control to the other actor but Sally is dead. Only Molly acts when I click on her. She acts according to her script but Sally is quite dead.
This is my Sally script:
; $EDITOR_PROJECT_ROOT_DIR$ ..\..\..\
ACTOR
{
NAME = "sally"
CAPTION="Sally"
SCALABLE = TRUE
INTERACTIVE = FALSE
X = 460
Y = 400
SCRIPT="actors\sally\sally.script"
FONT = "fonts\outline_red.font"
ANIMATION
{
NAME = "idle"
LEFT = "actors\sally\ll\stand.sprite"
RIGHT = "actors\sally\rr\stand.sprite"
UP = "actors\sally\uu\stand.sprite"
DOWN = "actors\sally\dd\stand.sprite"
UP_LEFT = "actors\sally\ul\stand.sprite"
UP_RIGHT = "actors\sally\ur\stand.sprite"
DOWN_LEFT = "actors\sally\dl\stand.sprite"
DOWN_RIGHT = "actors\sally\dr\stand.sprite"
}
ANIMATION
{
[blah blah blah-the usual--deleted to save posting space]
This is my Game.script:
#include "scripts\base.inc"
#include "scripts\keys.inc"
// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;
// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");
// load our main actor
molly = Game.LoadActor("actors\molly\molly.actor");
sally = Game.LoadActor("actors\sally\sally.actor");
actor = molly;
actor = sally;
Game.MainObject = actor;
// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");
Game.InventoryVisible = true;
// which scene to load?
Game.ChangeScene(Game.StartupScene);
////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
// what did we click?
var ActObj = Game.ActiveObject;
if(ActObj!=null)
{
ActObj.ApplyEvent("LeftClick");
}
// else propagate the LeftClick event to a scene
else
{
Scene.ApplyEvent("LeftClick");
}
}
on "RightClick"
{
if (Game.SelectedItem != null){
Game.SelectedItem = null;
}
}
////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
// on Esc or F1 key
if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
{
// load and display the main menu window
WinCaption.Visible = false;
var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
WinMainMenu.Center();
WinMainMenu.GoSystemExclusive();
Game.UnloadObject(WinMainMenu);
}
}
////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
// on Alt+F4 (window close)
// load and display the quit confirmation window
WinCaption.Visible = false;
var WinQuit = Game.LoadWindow("interface\system\quit.window");
WinQuit.Center();
WinQuit.GoSystemExclusive();
// and if the user selected Yes
if(WinQuit.xResult)
{
// quit the game
Game.QuitGame();
}
// otherwise just unload the quit window from memory
else Game.UnloadObject(WinQuit);
}
Urgh! (Not part of script)
This is the part of the book am following:
Now what we’ve done is that we’ve created another actor named Sally which uses the same graphics as a Molly, but it’s entirely different person. We have her reference stored in the global variable actor2 and we’ve placed her in our Room scene. Next thing we’re going to do is that we’re going to implement a neat character switching.
If player clicks on Molly or Sally (without an inventory item selected) game gives control to the second actor.
Now remember that everything in our scripts is set to use the global variable “actor”. So if we want to implement character switching, we simply set this variable to character of our liking. Also we have to change the Game.MainObject because it drives the screen scrolling and we want to maintain this functionality as well. So let’s open the file molly.script in the actor folder and add here the LeftClick handler:
on "LeftClick"
{
if (Game.MainObject == molly) actor.Talk("I am already selected!");
else
{
actor = molly;
Game.MainObject = actor;
}
}
Analogically we’ll modify the sally.script to read:
on "LeftClick"
{
if (Game.MainObject == sally) actor.Talk("I am already selected!");
else
{
actor = sally;
Game.MainObject = actor;
}
}
Although we could use single file for this, later on it pays off to have those separated when we want to perform different tasks with each actor.
Now run the game and note that we can switch between actors by simple Left Click on them.
I did all this. Sally is still dead. Will place flowers on her grave. : (