Button vs Sprite clicking: Wrong Variable Increment

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • In the below, if the BUTTON is clicked, CGStage has 1 added to its count.

    If the Sprite is clicked, CGStage gets a random number added, somewhere between 5-7.

    Is there some other condition I'm missing that makes Sprite-based buttons different than the Button object?

    I did see this thread https://www.scirra.com/forum/solved-thanks-add-1-to-count-yes-just-1-this-time_t181230 but I haven't gone into Families yet and I certainly don't want the Sprite-based button to be destroyed. In short, I got lost.

  • Unless you've got multiples of the same sprite stacked on each other, should work the same.

  • Ah, now there's a thing. There is another sprite directly below that one but it's set to invisible. Guess I'll need to figure out a new way around that now. Didn't know you could still interact with invisible objects!

  • Just add "Is visible" to the event.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Unfortunately it doesn't look like that works. From the manual:

    Is visible

    True if the object is currently visible. Invert to test if invisible. This only tests the visibility set by the Set visible action; it is not affected by the object being offscreen, having 0 opacity, or being on an invisible layer.

    I was trying to make a menu system using a single layout that simply turns layers on or off (rather than constantly going to a new layout for no reason) based on what was clicked. It doesn't look like that's possible, or at least, beyond my current level of knowledge.

  • You can correlate if the sprite is on a layer and if that layer is visible. It's all doable. Don't over-complicate though. If it's off screen, it can't be clicked on.

  • I figured out a way to do it, though it isn't perfect. It all operates on a single layer and once the CGStage variable is advanced, I simply use System Scroll to X. While it does make the layout pretty large, everything does work perfectly!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)