Why is my touch control not showing up?

0 favourites
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • I've decided to finally release my .capx because this is driving me insane.

    I took the working example from here, changed the sprites to my own, ran the example with my sprites to confirm that things worked, then copied and pasted them over into my project and... the analog joystick that is supposed to appear on screen never shows up.

    Can someone help me? This is the second day I have been trying to solve this and so far still no luck.

    <img src="http://i.imgur.com/zslCUV8.png" border="0">

    Icarus.capx

  • if nobody take a look before me, I'll help you on the evening.

  • Thank you! :)

  • Excal

    Good debugging skills can go a long way.

    First I wanted to make sure the stick and pad instances actually existed, so I set the debug text to show me the counts of both the "fanaPad" and "fanaStick" object. I saw that there were no instances of either object being created, even when the player touches the screen, so I added create actions upon touching the "Lefthalf" object.

    Now I could see the objects created when I touched them, but the stick wasn't moving with my touch. You calculate the stick's position when player is in touch, and the LeftTouchID variable is greater than or equal to zero. So then I set the debug text to LeftTouchID, and saw that it never changed from -1. I looked at the code and saw that you have LeftTouchID as a local variable set to -1. Since the local variable wasn't set to static, it was being reset to -1 every tick, and the stick's movement calculations weren't firing. I changed the LeftTouchID local variable to static, and things seemed to work fine.

    <img src="http://i.imgur.com/hoEnCtr.png" border="0" />

  • Thank you so much. This helped immensely.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • also, I organize my projects with many eventsheets, and include them all on a Main eventsheet.

    This is how I like to debug, the text here is mutated on purpose, I like to check if it's going well on Live, what layer the object is, because sometimes We do mistakes like you did, and it make easy to debug.

    I was ready to make it for you, including my personal debug system on your file, to show you how it can help you in future.

    Your problem is already solved?

    [TUBE]http://www.youtube.com/watch?v=pJFQftlOdH0[/TUBE]

    [TUBE]http://www.youtube.com/watch?v=AzlQhu9Dud4[/TUBE]

  • hi. i guess this is going to be a mobile platform game, isn't it?

    i'm working on a mobile platform game with joysticks too. in my case there are 4 players on the screen which are each controlled by the appropriate joystick. i chose another version of creakting touch input joysticks. (i could send you a capx tomorrow). my problem is: everything seems to work quite well until i test the game with cocoonJS launcher on my iPad. the joysticks sometimes start jiggling and shaking. i am just not confident with the result of the touch input.

    have you tested yours yet? is it working fine?

  • Wow, this thread has exploded! Thank you everyone for your amazing help and great insight.

    hi. i guess this is going to be a mobile platform game, isn't it?

    I actually intend to port it to iOS, but I won't discard the possibility of it being playable on a browser. I'm also entering it into the Newgrounds Construct 2 Touch Game Jam, so I absolutely have to have the game working with touch controls and decent FPS on various mobile devices.

    have you tested yours yet? is it working fine?

    On CocoonJS? Not quite yet. After the game jam, I intend on turning the game into an iOS space shooter with a story (ironic statement, I know, but I'm working with some writers lol). It saddens me to see that there could be issues with touch controls when exporting through CocoonJS.

    I understand Scirra develops Construct 2 as an HTML5 Game Engine, but if there are issues with porting to other platforms, that hurts the commercial viability of games created with their engine, which can turn people off if news gets around.

    also, I organize my projects with many eventsheets, and include them all on a Main eventsheet.

    I actually don't know how to include event sheets on another event sheet. I checked the manual, but maybe I'm just bad at finding where to do this.

    I was ready to make it for you, including my personal debug system on your file, to show you how it can help you in future.

    You don't need to do that, especially since I've modified the events after the changes to fix my touch control issue. I think it would be more helpful if you gave an overview of how you do it and the reasoning behind it (possibly in another post somewhere?). I've only recently begun reorganizing my event sheets. Originally, this project was around 400 for its current state - right now I've trimmed it down to 313.

    Your problem is already solved?

    Not quite, at least not multitouch.

    You can try it here: http://exeneva.com/html5/Icarus

    You'll notice that single touch is working fine, multitouch is having issues. So right now you can't fire and move at the same time.

  • To include an eventsheet, simple click on the "Add Include" button, inside the Events Menu, on the top left of your screen.

  • Thanks. I wonder if that's in the manual somewhere...

    I've added debug counters to my gameplay link above.

    Apparently if LeftTouchID = 0, when the user touches the right side of the screen, RightTouchID = 0, causing both touches to have the same ID. Is this a bug?

  • To include an eventsheet, simple click on the "Add Include" button, inside the Events Menu, on the top left of your screen.

    I know to reduce memory load/usage, it's wise to dump all objects into an 'object dump' layout.

    What about if you have to pin objects to another? Suppose I have the brakes on my spaceship positioned exactly. If I move the spaceship to another layout, how would I 'move' the ship to the current layout without having to repin everything, especially since scaling might mess with the pin positions?

  • just set the X and Y and pin right after it, on an Start of Layout event.

    I do everything via code, that BACKUP canvas is only to preview and loading purpose.

  • just set the X and Y and pin right after it, on an Start of Layout event.

    I do everything via code, that BACKUP canvas is only to preview and loading purpose.

    Suppose I have multiple instances of an object. For example, I have four instances of the brakes sprite.

    Would I just create that sprite multiple times and then pin it? What if each instance has a different angle?

  • aah lol i missunderstood your problem a bit. but i really DO have the solution to your problem. in my game there are 4joysticks and 4players and they can be used all at the same time so 4 fingers are touching the screen and the every joystick responds to the appropriate touch input.

    how i did this:

    i made a invisible layer at the top called "subdivision". in that layer i devided the screen into 4 rectangles called "tracker1" ,2,3 and 4.

    now i have global variables calld touchID_player1,2,3 and 4 and an event like touch is overlapping tracker1 -> store touchID in variable touchID_player1.

    i can send you a capx. as soon as i get on my desktop computer if you want to.

    ps: maybie ill make a tutorial on that in near future.

  • philx

    I'm doing the same thing, except without the object in order to save memory.

    Mine detects whether they've touched the left or right side of the screen:

    Touch.X > ViewportRight("TouchInterface")/2 and Touch.X < ViewportRight("TouchInterface")/2

    However, I'm having issues when both the left and right are touched at the same time. Namely, the second touch ID reverts back to -1 almost immediately.

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