Inventory item triggers on screen speed throttle

Started by Barn Owl, Thu 15/05/2025 00:30:13

Previous topic - Next topic

Barn Owl

Hi all!

Thanks again for all of the assistance here. The game is coming to life, and I think it's fun.

I'd like to add an inventory item that bypasses clicking the settings menu from the drop down GUIs. This item would toggle a vertical on-screen speed slider off and on. We'll call it oMagicGearShifter. And if oMagicGearShifter is used on cEgo, a vertical speed slider GUI appears and remains on screen. And if oMagicGearShifter is used on cEgo while the speed control is already present, it will disappear.

I've noticed that speeding/slowing certain animations is kinda fun. I'd like to give the play immediate control to do so, rather than drop down menu>settings.

The on screen display could either be a slider, as it is in the GUI settings menu, except vertical... Or it could be a simple two button device where one button increases the game speed by 10% and the other decreases by the same amount.

If anyone can nudge me in the right direction I think I can make it happen. And hopefully down the line somebody will get a smile out of playing.

Gracias as always, I admire you all and enjoy all the information here!

Edit: I think I can presently make this function via the object GUI being a "two button device". That's starting to make sense as to how to go about that. However, the slider version I have very little idea how to create.

Khris

AGS supports vertical sliders out of the box. Just put a slider on a GUI and set/drag its dimensions so that it's taller than wide.

As for the inv item, something like this should work:

Code: ags
// created and linked to via the character's event table as usual
function cRoger_UseInv(Character *theCharacter, CursorMode mode)
{
  if (player.ActiveInventory == iMagicGearShifter) {
    gGearShifter.Visible = !gGearShifter.Visible; // toggle visibility
  }
  else {
    player.Say("..."); // reaction to other items
  }
}

Barn Owl

Excellent, thanks!

Starting to kind of have a decent game here...

SMF spam blocked by CleanTalk