Objects, GUIs and workarounds

Started by Salzi, Fri 22/03/2019 13:11:45

Previous topic - Next topic

Salzi

Hey guys,

right now I'm trying to figure out something that might have a real quick and easy solution for it, so you guys can surely help me.
My game has a notebook GUI (see picture below) that is accessible always via the book icon in the upper left hand corner of the screen.
It has a bunch of stuff in it, and multiple connecting GUIs as pages. At the corners of the book there are invisible buttons to flip the pages.



Now, I want to add a page where the player has to solve a puzzle inside the notebook, with a kind of - for lack of a better word - shifting and animating select mechanism.
Click on the arrow, it animates the shift and comes to a halt at the next word. It's supposed to look like this in the end:



As you appearently can't animate things in GUIs, I had to find a work around.
I planned on making the notebook page that is needed an object instead, so closing the GUI and making the object visible when you flip the last GUI-page.
The next step would be to make a transparent GUI with buttons that make the arrows work and put it on top of the object.

The problems I've run into:

  • I can't seem to access the object in the global script, so this:
Code: ags
function Button214_OnClick(GUIControl *control, MouseButton button)
{
  AufgabenBuch.Visible = true;
}

    unfortunately doesn't work. Any way to do this easily?

    • Changing the images on the object. I know that it's possible to interact with objects, but this is not what I want.
      I need the image on the object to animate and change without the player interacting with the actual book-object, i.e. the player pressing the invisible GUI-button and the image changing. Any ideas about this?

    I'm sorry for this being a little hefty and thanks in advance, guys!

Cassiebsg

#1
But you can animate stuff in GUIs!
Just use a button and then you can animate it.  ;) Note that the fact that it's a button doesn't mean you need to make the button be clickable and do something.

And to answer your question, to animate room objects in Global you can't address it by name (as far as I know) you need to do object[0].Visible=true; // or whatever the ID number to that object is.
But as I said, you can animate buttons in GUIs, so that would be an easier solution IMHO.  ;)

EDIT:
Code: ags

button.Animate(int view, int loop, int delay, RepeateStyle) ; 


Hope it helps.  (nod)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk