SOLVED: Left click only to move through rooms?

Started by Chuchuana, Sun 10/09/2017 03:51:38

Previous topic - Next topic

Chuchuana

hey there, folks!
i'm very, very new to ags and game creation alike, and have decided to make a small game for a special occasion!
my initial idea was to just have a simple little point and click game, where the player could click certain areas to progress through the rooms. i seem to have gotten it down so far, but for some reason i'm only able to move to the next room when left and right clicking simultaneously. ideally i'd like to be able to just left click on particular hotspots to progress!

if anyone could help me figure this out, i'd be truly grateful! if you need any additional info, please let me know and i'll provide everything i can.

thanks so much in advance! ââ,,¢Â«

Kitty Trouble

What is the code you are using to move between rooms now?

Chuchuana

Quote from: Morgan LeFlay on Sun 10/09/2017 04:39:25
What is the code you are using to move between rooms now?

honestly, just the very very basic anyclick changeroom function has been working!:

Code: ags

function hHotspot1_AnyClick()
{
player.ChangeRoom(2);
}


the only issue is it only registers a click when i click lmb and rmb at the same time :(

Kitty Trouble

QuoteAny click on hotspot
occurs when the player clicks on the hotspot in any cursor mode (except Walk). This allows you to add extra modes like smell, taste, push, pull, and so on. This event also occurs as well as the other event for the Look, Interact and Talk modes.

The reason it might work with "both mouse buttons" is because right clicking changes the cursor mode from walk to something else.

So you have 2 options... change your code so that something else (like interact) is the default cursor, OR you can use a code like:

if (mouse.IsButtonDown(eMouseLeft) && Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hHotspot1)
{
  player.ChangeRoom(2);
}

which goes in repeatedly_execute function. A bit more code than that if you want it to detect new clicks and not only if the mouse button is down.

This is all assuming you're not having a character that walks around, because then you could use the walks on hotspot one.

Chuchuana

oh gosh, this is perfect!! it works just like i needed it to, thank you so much for your help!! :-D ââ,,¢Â«

Khris

The walk cursor does not trigger the "Any click on..." events.
Just change the mouse mode to any other mode, for instance by setting it in the GlobalScript's game_start function

Code: ags
function game_start() {
  // other contents here

  mouse.Mode = eModeInteract;
}

SMF spam blocked by CleanTalk