Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - SBOVIS

Pages: 1 ... 24 25 [26] 27
376
Technical forum / Re: MENU animations 2
« on: August 12, 2004, 12:18:37 PM »
Hi Mnemonic,
                   Have entered the code but now nothing happens............


here 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;

global SeenMenu;
if(SeenMenu==null) SeenMenu = false;

// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetWidget("caption");





// load credits fader
global WinCredits = Game.LoadWindow("interface\credits\credits.window");
WinCredits.Visible = true;


global MenuObject = null;


// load our main actor
actor = Game.LoadActor("actors\BRIGGS\BRIGGS.actor");
Game.MainObject = actor;

// run the "daemon"
Game.AttachScript("scripts\game_daemon.script");

// initial items
Game.TakeItem("money");


// which scene to load?
Game.ChangeScene("scenes\room\room.scene");



////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    // clicking an inventory item
    if(ActObj.Type=="item" && Game.SelectedItem==null)
    {
      Game.SelectedItem = ActObj;
    }
    // using an inventory item on another object
    else if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
      var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
      else if(Item.CanHandleEvent("default-use")) Item.ApplyEvent("default-use");
      else if(ActObj.CanHandleEvent("default-use")) ActObj.ApplyEvent("default-use");
      else actor.Talk("I can't use these things together.");
    }
    // just a simple click
    else ActObj.ApplyEvent("LeftClick");
  }
  // else propagate the LeftClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



////////////////////////////////////////////////////////////////////////////////
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.GetWidget("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
 


if(!SeenMenu)
{
   WinMenu.SetImage("data\interface\menu\men2.sprite");
   SeenMenu = true;
}
else WinMenu.SetImage("data\interface\menu\menu.sprite");



      // 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");
  }
}


////////////////////////////////////////////////////////////////////////////////
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);
}




any ideas???



steve



377
Technical forum / Re: MENU animations 2
« on: August 11, 2004, 03:09:17 PM »
Do i put this global variable in the data\scripts\game.script ?

and put it where the menu is called?

     // and show the right-click menu
 
WinMenu.SetImage("data\interface\menu\menu.sprite");
WinMenu.Visible = true;



steve

378
Technical forum / Re: MENU animations 2
« on: August 11, 2004, 11:51:08 AM »
Hi Mnemonic,
                  All works great but need a change to it, what i want is the initail animation to play when the user first selects the menu then everytime after that it plays an animation that is different to the initail one.

Also on both animations because they are sprites can I add a sound effect via sprite edit or do I need to code it?


Last post on this subject honest.

I am going to add you to my game credits as Engine creator and co-scripter is this ok?

link to game website:-

http://www.geocities.com/stevenbovis/LIMBO_of_the_LOST.html


Many thanks


Steve

379
Technical forum / Re: options menu
« on: August 06, 2004, 11:46:38 AM »
HI MNEMONIC,
                      I have changed the main menu script to this -

WINDOW
{
  WIDTH = 280
  HEIGHT = 240
  NAME = "mainmenu"

  TITLE = "Main menu"
  TITLE_RECT { 5,5,255,25 } 
  TITLE_ALIGN = left
  DRAG_RECT { 0,0,255,25 }
  IMAGE = "ui_elements\win.image"
  IMAGE_INACTIVE = "ui_elements\win_inactive.image"
  FONT = "fonts\outline_white.font"
  SCRIPT = "interface\system\mainmenu.script"

;----- close button -----
  BUTTON
  {
    TEMPLATE = "ui_elements\template\but_cls.button"
    X = 246
    Y = 5
  }

;----- menu buttons -----
  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "close"
    TEXT = "Resume game"
    X = 10
    Y = 35
    WIDTH = 250
    HEIGHT = 40
  }

  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "load"
    TEXT = "Load game"
    X = 10
    Y = 85
    WIDTH = 250
    HEIGHT = 40
  }

  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "save"
    TEXT = "Save game"
    X = 10
    Y = 135
    WIDTH = 250
    HEIGHT = 40
  }

  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "quit"
    TEXT = "Quit game"
    X = 10
    Y = 185
    WIDTH = 250
    HEIGHT = 40
  }
}



but what about the WIN definition file?

TILED_IMAGE
{
  IMAGE="ui_elements\win.bmp"
  VERTICAL_TILES {30, 30, 30}
  HORIZONTAL_TILES {30, 30, 30}
}


is there any other files I need to change from BACK to IMAGE?

Am very new to all this please bear with me but am learning quite fast. (with your help that is)


Many thanks.


Steve


380
Technical forum / options menu
« on: August 05, 2004, 11:29:22 AM »
Hi all,
        Has anyone got a good options menu rather than the standard one in the demo, I want to use a graphic image instead of a tiled one.

Any code or template, workshop would be very grateful.

The options can be standard - like quit, save, load, resume.






Many thanks


Steve



381
Technical forum / Re: MENU animations 2
« on: August 03, 2004, 03:41:43 PM »
sorry Mnemonic was unclear on this.

Works well now thank you.



Steve

382
Technical forum / Re: MENU animations 2
« on: August 03, 2004, 02:53:51 PM »
MODIFIED SCRIPT:

#include "scripts\base.inc"

global WinCaption;
global WinMenu;

// infinite loop
while(true){

  // save the active object for later
  var ActObj = Game.ActiveObject;

  // handle the standard foating caption
  if(Game.Interactive && ActObj!=null)
  {
    if (Game.SelectedItem==null)
    {
      WinCaption.X = Game.MouseX;
      WinCaption.Y = Game.MouseY + 20;
      WinCaption.TextAlign = TAL_LEFT;
      WinCaption.Text = ActObj.Caption;

      // keep the caption on screen
      WinCaption.SizeToFit();
      if(WinCaption.X + WinCaption.Width > Game.ScreenWidth) WinCaption.X = Game.ScreenWidth - WinCaption.Width;
      if(WinCaption.Y + WinCaption.Height > Game.ScreenHeight) WinCaption.Y = Game.ScreenHeight - WinCaption.Height;
     }
    // handle the caption when you want to use an object with another
    else {
      var Item = Game.SelectedItem;

      WinCaption.X = 0;
      WinCaption.Y = 580;
      WinCaption.Width = Game.ScreenWidth;
      WinCaption.TextAlign = TAL_CENTER;
      WinCaption.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
    }
    WinCaption.Visible = true;
    WinCaption.Focus();
  }
  else WinCaption.Visible = false;

  // display the inventory window
if(Game.Interactive && Game.MouseY < 10 && !Game.ResponsesVisible && !WinMenu.Visible)
{
  if(!Game.InventoryVisible)
  {
    var InvWin = Game.GetInventoryWindow();
    InvWin.SetImage("data\interface\inventory.sprite");
    Game.InventoryVisible = true;
  }
}
else if(Game.MouseY > 110 || Game.ResponsesVisible || !Game.Interactive) Game.InventoryVisible = false;
  // go to sleep for 20 miliseconds to allow the engine to perform other tasks
  // it is important for the "endless" scripts to call the Sleep command, otherwise the game will get stuck
  Sleep(20);
}


Cheers

steve

383
Technical forum / Re: MENU animations 2
« on: August 03, 2004, 02:15:46 PM »
The inventory works great now, but still stuck on the menu animation.


Have changed the game-demon script to include what you said above but nothing happens.


Any ideas where I am going wrong?


Many thanks mnemonic and the forum.



Steve

384
Technical forum / Re: MENU animations 2
« on: July 30, 2004, 04:37:22 PM »
great it works now, thanks mnemonic, will try menu and let you know.


Many thanks.


Steve

385
Technical forum / Re: MENU animations 2
« on: July 30, 2004, 03:10:53 PM »
I have done this, but it only animates when I press Quit or Esc not when the Inventory pops up.

It also animates if the mouse pointer is on Y position 45 after the screen is shown.

I need it to animate exactly as the inventory screen appears.


Steve



386
Technical forum / Re: MENU animations 2
« on: July 30, 2004, 02:51:04 PM »
thanks mnemonic but having trouble implementing this.

This is the script:

global WinMenu;

// infinite loop
while(true){

  // save the active object for later
  var ActObj = Game.ActiveObject;

  // handle the standard foating caption
  if(Game.Interactive && ActObj!=null)
  {
    if (Game.SelectedItem==null)
    {
      WinCaption.X = Game.MouseX;
      WinCaption.Y = Game.MouseY + 20;
      WinCaption.TextAlign = TAL_LEFT;
      WinCaption.Text = ActObj.Caption;

      // keep the caption on screen
      WinCaption.SizeToFit();
      if(WinCaption.X + WinCaption.Width > Game.ScreenWidth) WinCaption.X = Game.ScreenWidth - WinCaption.Width;
      if(WinCaption.Y + WinCaption.Height > Game.ScreenHeight) WinCaption.Y = Game.ScreenHeight - WinCaption.Height;
     }
    // handle the caption when you want to use an object with another
    else {
      var Item = Game.SelectedItem;

      WinCaption.X = 0;
      WinCaption.Y = 580;
      WinCaption.Width = Game.ScreenWidth;
      WinCaption.TextAlign = TAL_CENTER;
      WinCaption.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
    }
    WinCaption.Visible = true;
    WinCaption.Focus();
  }
  else WinCaption.Visible = false;

  // display the inventory window
 
if(Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible) Game.InventoryVisible = true;
  else if(Game.MouseY > 100 || Game.ResponsesVisible || !Game.Interactive) Game.InventoryVisible = false;



  // go to sleep for 20 miliseconds to allow the engine to perform other tasks
  // it is important for the "endless" scripts to call the Sleep command, otherwise the game will get stuck
  Sleep(20);
}



Do I delete the whole part of the Inventory code - 

// display the inventory window
 if(Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible) Game.InventoryVisible = true;
  else if(Game.MouseY > 100 || Game.ResponsesVisible || !Game.Interactive) Game.InventoryVisible = false;

and put your code?


I am a bit lost.



Steve


387
Technical forum / MENU animations 2
« on: July 30, 2004, 01:12:29 PM »
Hi all,
        Following on from my query regarding animateing menus and Inventory, I have done just that following Mnemonics advice to create a Sprite rather than a BMP.

But the animation only plays once, when you go into the Inventory or access the Menu.

How can I do it so that it plays everytime the player opens Inventory or a menu??


Any ideas??

By the way I am using the Demo Inventory and the Demo menu scripts.



Many thanks


Steve

388
Technical forum / Re: menu animations
« on: July 28, 2004, 01:51:06 PM »
Great thanks a lot, thought you could only use static images.

The same foes for the Inventory i take it.



Regards



Steve

389
Technical forum / menu animations
« on: July 28, 2004, 01:19:28 PM »
Hi all,
       I have created a menu with options on it like, TAKE, EXAMINE etc. (in a graphic form)
When the player selects these options i want an animation to play. Like the image to glow or spin etc.


Also In the Inventory screen can I have an animated sprite on that too, displays when player moves mouse to top of screen.

Any code or advice would be welcome.


Many thanks


Steve

390
Technical forum / Main character animations & other things
« on: July 20, 2004, 03:53:53 PM »
Hi all,
       Could I have some code please to help with the following:-

When the main actor reaches a specific place in the scene (you clicked on the place) he does a specific defined animation.

Example: Player clicks on stone steps, ACtor walks over and when hits the area defined in Scene edit he climbs the steps (series of animation frames)


The same code can be used for automatic reactions by the actor like walking past a mirror , climbing a rope, crawling through a hole, jumping a gap etc.



Also can collision be done between the Main actor and an NPC. Example Npc walking around in scene and your paths meet, could be a rat, bat or another human.


Many thanks for your past and future help.


Regards


SBovis





Pages: 1 ... 24 25 [26] 27

Page created in 0.104 seconds with 19 queries.