How do I Add Functionality to Sprite Buttons?

0 favourites
  • 13 posts
From the Asset Store
Kids Game
$24.50 USD
50% off
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • Or maybe I'm doing this entirely wrong, but in downloading a theme pack, don't I add in a button as a sprite? If so, how can I actually get this button functionality like hover?

    Thank you!

  • Several options:

    1. Use Button object and style it with CSS. But this is not a good choice for many games, because HTML elements are rendered above the canvas (or will require a special HTML layer), can "steal" mouse focus and have a few other annoying quirks.

    2. Use a sprite with several frames or animations. If mouse cursor over the sprite -> Set frame 1, Else set frame 0. On sprite clicked -> Set animation "clicked" and so on.

    3. Use an addon like ProUI. (also not recommended unless you require lots of other UI controls)

  • Ok, that worked! Is it possible to add text to a sprite inside of the editor screen, or do I actually need this separate sprite text layer on top of it as a separate item?

  • And also, what is preventing this layer 2 from appearing when I click on the button (while obviously hovering over it too)?

  • Is it possible to add text to a sprite inside of the editor screen, or do I actually need this separate sprite text layer on top of it as a separate item?

    You need to add a text object on top of the button sprite, yes. You can add them to a hierarchy, then the text will scale with the button, move with the button etc.

    And also, what is preventing this layer 2 from appearing when I click on the button (while obviously hovering over it too)?

    That's why I suggested to use a different animation when the button is clicked. Something like this:

    Button set animation to "clicked"
    Wait 0.1 seconds
    Button set animation to "idle"
    

    Then changing animation frame will have no effect.

  • Thank you, this makes sense. I'm not sure how to add wait time though. Is that through system? I didn't see it there.

  • Yes, System -> Wait

  • Must not be available in the free version.

  • It's one of the most basic actions, it's definitely available in free version.

    Make sure to disable "Use simplified user interface" in program settings.

  • I have that disabled. I'm still not seeing it! Is it called, "Wait"? I'm not seeing it when I try and select it as a System condition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, it's not a condition, it's an action.

  • Ok, got it working now! Only thing that looks weird is if I click on the button and hold left click down, it times out obviously after 0.1 seconds. Looks sort of glitchy.

  • Nevermind--that was an easy fix! I'm all set :) Thank you so much for the help this week.

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