How do I only use one click throughout the game?

Started by JennaAbbott, Wed 03/06/2009 00:26:44

Previous topic - Next topic

JennaAbbott

I don't want the walk to, interact with and look commands above the top of the screen, in fact I would like to remove the status lin and iconbar completley and only use one mouse click for every action (if clicked on walkable area it will walk, if clicked on hotsopt it will intereact and so forth)

Khris

Turn the GUI's visibility settings to "Normal, initially off".
If you want the game source to be tidy, remove all their button's OnClick functions and delete the GUIs.

To use only one click, one way is using something like this as on_mouse_click:

Code: ags
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  
  if (IsGamePaused() == 1) return; // Game is paused, so do nothing (ie. don't allow mouse click)

  if (button != eMouseLeft) return; //  react only to left clicks

  int lt = GetLocationType(mouse.x, mouse.y);
  int mm;

  if (lt == eLocationNothing) mm = eModeWalkto;
  if (lt == eLocationHotspot || lt == eLocationObject) mm = eModeInteract;
  if (lt == eLocationCharacter) mm = eModeTalkto;

  ProcessClick(mouse.x, mouse.y, mm);
}


Note that this prevents the player from looking at anything and using inventory items.

A more common way is to use a right click to look at things; this interface is commonly known as BASS or Broken Sword interface; a number of threads on how to implement it already exist, some of them being relatively recent.

JennaAbbott

Thank you so much... well, I am doing a childrens interactive storybook, and if i need to look at something, i will display the message through the interact function if I do not have to do anything else. If something DOES need to be used (eg putting a found umberella up) I will display the message, wait for the click, then show animation of the character putting the umberella up.

SMF spam blocked by CleanTalk