Need Help with Floating Joystick & Crosshair Issues in Construct 3

0 favourites
  • 2 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi Guys,

    I am very new to Construct 3 and have a problem with my shooting game project.

    I made this game work on both mobile and PC.

    I have coded it so that a floating joystick control appears only when playing on the touch devices.

    However, there are some issues with that code while playing on mobile:

    1. An unwanted crosshair appears at position (0,0) on mobile: i.vgy.me/CWVvql.png

    I can't figure out how or why it's happening. This issue only appears on mobile devices, when playing on PC, it doesn't show up.

    I couldn't use debug preview to check which crosshair is appearing at (0,0) since I have to use remote preview to test on mobile devices.

    I am using separate crosshairs for mobile and PC because the controls are different:

    "Crosshair" for PC

    "crosshair_touch" for mobile

    2. When using the mobile touch joystick, the crosshair keeps moving toward the last movement direction even after I stop moving the joystick. It doesn't stop when I release the joystick.

    I have attached event images and a video for better understanding. Please check below:

    Mouse control: i.vgy.me/Pe0Sxq.png

    Touch control: i.vgy.me/mCJdbd.png

    Problem video: webmshare.com/play/NARBm

    Thanks...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi! By looking at your code, i suppose that the problems are:

    1. The crosshair at (0,0) is the PC crosshair. In the cursor controls group you set the PC crosshair position to (mouse.x , mouse.y), however on mobile these expressions default to zero (since you don't use a mouse on mobile devices).

    2. the touch crosshair position is reset when the joystick is dropped, but in your events you move it every tick whithout checking if you're actually using the joystick or not.

    To fix 1. use the PlatformInfo plugin to detect wether you are on PC or on mobile. If you are on mobile, delete the PC crosshair.

    To fix 2. ensure that you are dragging the joystick before moving the crosshair (just add a is Dragging Joystick condition on the first event on joystick controls).

    Hope this helps.

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