Detect platform?

0 favourites
  • 9 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • My game has on-screen touch sprites that will appear if they are on a iOS device, but these shouldn't appear on a desktop or any other platform that has a keyboard of some kind.

    How do I determine whether the player is on iOS or on a desktop?

  • Bump. An answer to this would be really nice. Do I need to use a plugin?

  • You can use this: "On any touch" and enable an entirely event sheet after this, and doing your sprites to appear on this code (setting them invisible doesn't mean they will be untouchable, so, only create then when any touch is detected is a better way to go..)

    There is somewhere an option called "touch screen is detected", or "on touch enable", I remember this option but was unable to find it.

    Good tutorial:

    scirra.com/tutorials/202/touch-controls-and-a-trick-to-detect-input-method

  • When checking for touch on a specific object, is that object's collision polygon used, or the entire sprite box?

  • It uses the collision polygon, as does the mouse object.

  • You can use this: "On any touch" and enable an entirely event sheet after this, and doing your sprites to appear on this code (setting them invisible doesn't mean they will be untouchable, so, only create then when any touch is detected is a better way to go..)

    There is somewhere an option called "touch screen is detected", or "on touch enable", I remember this option but was unable to find it.

    Good tutorial:

    https://www.scirra.com/tutorials/202/touch-controls-and-a-trick-to-detect-input-method

    JavaScript plugins exist for detecting platform. I would love to see one integrated into Construct 2.

    What you described works, but it's a hack. Suppose the user is on Android, which is on phones with a keyboard, but that user touches the screen. Given that Android devices vary in screen size, I would prefer the user play with the keyboard instead of using touchscreen controls, which would take up 1/4 of that player's screen at the least.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the user is on an Android phone or any touch device with a keyboard you should give the user an option to use touch or the keyboard. Have some sort of variable (either global or in an array) keep track of which input mode the game is in. If a key press event occurs, hide the controls and make them untouchable if they're hidden while enabling the keyboard controls. If a touch event occurs unhide the touch controls, disable keyboard events.

  • I'm doing this already.

    However, Android users may touch the screen and end up using touch controls when they have a keyboard. Considering Android screen sizes vary by phone model (they're not consistent like iPhones are), this means the actual gameplay area is smaller than if they used the keyboard.

    But as I said, there are Javascript libraries that detect what kind of platform the app is running on. What we're doing right now is a hack to accommodate different types of input. Why can't C2 integrate one of these libraries or otherwise detect the phone platform?

  • Nevermind, I guess there is a way to detect platform...

    https://www.scirra.com/manual/110/browser

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