How do I get a button working on mobile?

0 favourites
  • 2 posts
From the Asset Store
Casual Game UI Button Flat Design made in vector (Adobe Illustrator).
  • Ok, so I know that the subject sounds incredibly dumb, but I couldn't fit exactly what I needed help with into a few words...

    What I really need help with is finding out how to make an invisible button (or sprite that acts as a button) that has an event triggered every so many seconds that the button/sprite is being held down. Specifically, I'm making a side-scrolling airplane/dogfight game, and I want it to be playable on mobile devices. I already have it so that the start screen can tell whether to load in the mobile or keyboard layout for the full game, but I can't figure out the controls. I tried making blank sprites that scrolled with the view of the player (one on the bottom, one on top) for movement (up and down), and then making a sprite that acted as a "fire" button. I then used "System - Every tick + Touch - Is touching (Sprite) > Player - Move 5 pixels at angle 90", which is what I had for the keyboard, but replacing the arrow key with "Touch - Is touching (Sprite)". I also did basically the same thing for the "fire" button sprite; but none of the "button-sprites" worked on my mobile device. I then thought that maybe conventional Button objects might work, but when going to place the condition for it, I realized that there was no "Is holding down" on the button...

    If anyone has any ideas please share them with me, as I accept that my event "coding" may have been off, or that i just haven't thought of everything. I'm sure this is a common problem, so someone should probably see this and have a simple solution.

    Thanks -

    DKinGer

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can always use this workaround:

    - (Condition) Is touching object [Button][/code:2p05s6u7]
    If you are using the mouse, you can use this:
    [code:2p05s6u7]- (Condition) Mouse is over object [Button]
    [ul]
    	[li](Condition) Left mouse button is down[/code:2p05s6u7][/li]
    [/ul]
    Also, a little side note:
    
    

    "System - Every tick + Touch - Is touching (Sprite) > Player - Move 5 pixels at angle 90"

    You can remove the Every tick condition, see why here.

    Also, one last thing:

    If you're asking questions that are specific to your project, try to always attach a .capx of your project.

    It helps the community to understand your problem better and thus, it helps you to get a faster and better response.

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