Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Armageddon on Mon 19/07/2010 21:33:18

Title: A gameplay question
Post by: Armageddon on Mon 19/07/2010 21:33:18
I played this game yesterday, Death (http://www.moddb.com/games/death-episode-1-the-scythe-of-unlimited-power), and I'm kinda new to ags still and I was wondering if anyone could tell me how these two things were done. So when you mouse over what I'm guessing is a hot spot the text of that thing appears ot the bottom of the screen would you use a GUI for this or what? Also when you left click it interacts and when you right click it looks, how is this done? Thanks in advance! ;)
Title: Re: A gameplay question
Post by: Vince Twelve on Mon 19/07/2010 21:53:51
Yup, use a GUI with a label.  Look up Game.GetLocationName or @OVERHOTSPOT@ in the manual or by searching the forums.

For left click interact, right click examine, you'll just change the on_mouse_click function.  Something like:

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
  {
  }
  else if (button == eMouseLeft)
  {
    ProcessClick(mouse.x,mouse.y, eModeInteract);
  }
  else // right-click, so examine
  {   
    ProcessClick(mouse.x,mouse.y, eModeLookat);
  }
}
Title: Re: A gameplay question
Post by: Armageddon on Mon 19/07/2010 22:10:39
Like I said I am still very new, where exactly would I put the mouse code? ???
Title: Re: A gameplay question
Post by: Vince Twelve on Mon 19/07/2010 22:49:41
There should already be a on_mouse_click function in your global script file.
Title: Re: A gameplay question
Post by: karja on Tue 20/07/2010 07:09:07
This is the code we used in Death episode 1.

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {

  if (IsGamePaused() == 1){
    //Game is paused, so do nothing on any mouse click
  }else{
    if (button == eMouseLeft){
      //left mouse button
      if (GetLocationType(mouse.x, mouse.y) == eLocationNothing){
        //not over hotspot so walk
        ProcessClick(mouse.x, mouse.y, eModeWalkto);
      }else{
        //over a hotspot/object etc
        if (mouse.Mode==eModeUseinv){
          //using inventory on hotspot
          ProcessClick(mouse.x, mouse.y, eModeUseinv);
        }else{
          //not using inventory, so Interact
          ProcessClick(mouse.x, mouse.y, eModeInteract);
        }
      } 
    }else if (button == eMouseRight){
      //right mouse button
      if (mouse.Mode==eModeUseinv){
        //inventory item out, so cancel it
        mouse.Mode=eModeWalkto;
      }else{
        //no inventory item out, so look
        ProcessClick(mouse.x, mouse.y, eModeLookat);
      }
    }else if (button == eMouseWheelNorth){
      //mouse wheel up
    }else if (button == eMouseWheelSouth){
      //mouse wheel down
    }
  }

}
Title: Re: A gameplay question
Post by: Armageddon on Wed 21/07/2010 20:28:51
Not sure if I should start an new thread, but I was wondering how you install modules? I want to try this one for the bottom screen text, when over hotspot.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26306.0
Title: Re: A gameplay question
Post by: Dualnames on Wed 21/07/2010 23:41:47
http://www.youtube.com/watch?v=drsb_Dvw-yM

Here's a visual way.