How do I set te touch ID?

Get help using Construct 2

Post » Wed Jul 12, 2017 2:27 pm

i am trying to make a game with controls similar to badland (the screen is split in 2 parts and touching the right side will make character R move, touching the left side would make character L move) My game is more advanced and need the touch.xforid and touch.yforid . How do i make it that touching the right side will always move the R character and touching the left side will always move the L character. a fix for the problem would be that when you touch a side it sets the touchid to a certain number but i don't know how to do that. Help wouuld be highly appreciated
B
8
Posts: 37
Reputation: 383

Post » Wed Jul 12, 2017 3:54 pm

Divide the screen with two invisible sprites which the player cant see, put one on the left side other on the right size, if player touches the left screen it will also touch the invisible sprite, you can use this to determine which size is touched and move the right player.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Wed Jul 12, 2017 7:53 pm

imhotep22 wrote:Divide the screen with two invisible sprites which the player cant see, put one on the left side other on the right size, if player touches the left screen it will also touch the invisible sprite, you can use this to determine which size is touched and move the right player.
i already did that but that do3sn't answer my question. I need the sides to Always have the same TouchID. For example the left side to have TouchID(0) and the right one to have TouchID(1). If i first press on the right then on the left, the right will have touchID(0) and the left touchID(1)
B
8
Posts: 37
Reputation: 383

Post » Thu Jul 13, 2017 11:36 am

Keep the touch Id as an instance variable in the invisible sprite, make left always 0 and right 1, when you touch it, set the value from the instance variable.


Can you provide more info on the movement, like lets say you touch the left side of the screen, then left player is moving, but how? Do you use a arrow panel where you move the players and tap to select which one you more, of when you just tap then the left size left player moves automatically?
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Thu Jul 13, 2017 12:18 pm

ID in XForID is a number assigned by the system. You can not change its value to anything you want to.
You can of course change that value by touching screen.
The expression Touch.TouchID is holding the value of it.

Write Touch.TouchID to a textbox under a 'On any touch start' event. Watch it evolve to understand it.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jul 13, 2017 6:05 pm

imhotep22 wrote:Keep the touch Id as an instance variable in the invisible sprite, make left always 0 and right 1, when you touch it, set the value from the instance variable.


Can you provide more info on the movement, like lets say you touch the left side of the screen, then left player is moving, but how? Do you use a arrow panel where you move the players and tap to select which one you more, of when you just tap then the left size left player moves automatically?
but how do i set the touch ID, i can't find an event. So basically the screen is split in 4 and there are 4 characters, the 4 sections act likr gamepads, each controling a certain character. Te characters have a bullet behavior, yhe gamepad only sets the angle of the character.
B
8
Posts: 37
Reputation: 383

Post » Thu Jul 13, 2017 6:07 pm

99Instances2Go wrote:ID in XForID is a number assigned by the system. You can not change its value to anything you want to.
You can of course change that value by touching screen.
The expression Touch.TouchID is holding the value of it.

Write Touch.TouchID to a textbox under a 'On any touch start' event. Watch it evolve to understand it.
so how can i make the following game : screen split in 4. Every section acts like a gamepad for 1 character. Characters have bullet and the "gamepad" only sets the angle .
B
8
Posts: 37
Reputation: 383


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests