A gameplay question

Started by Armageddon, Mon 19/07/2010 21:33:18

Previous topic - Next topic

Armageddon

I played this game yesterday, Death, 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! ;)

Vince Twelve

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:
Code: ags

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

Armageddon

Like I said I am still very new, where exactly would I put the mouse code? ???

Vince Twelve

There should already be a on_mouse_click function in your global script file.

karja

This is the code we used in Death episode 1.

Code: ags
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
    }
  }

}

Armageddon

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

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk