multi touch drag and recognition

Get help using Construct 2

Post » Thu Dec 26, 2013 6:05 pm

Hi!

I developed a game that works fine on the windows 8 pc (Saving Spidy), this game requires you to save all the spiders from a cauldron at the bottom of the level, dragging them towards caves on both sides of the level.

When I ported to the WP, I noticed that it reacts weird when I'm touching a spider and another one appears and I tried to touch it with another finger.

I believe it is because I may be using Touch.X, Touch.Y

Any idea how can I associate a touch location to a finger, so I can drag 2 spiders in different sides of the screen, at the same time to different places?

Thanks!!!
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Fri Dec 27, 2013 12:41 pm

Can you expand on 'reacts weird'. What exactly is the bug that's occurring? Also I'm not sure mobile games make use of gameplay such as using multiple fingers? Seems a little weird to be able to do that really. I would expect that I could drag things with one finger but not use two different fingers to drag two different objects at the same time. That being said, it should probably work fine. Were you using the drag/drop behaviour?
B
46
S
15
G
73
Posts: 2,026
Reputation: 43,459

Post » Fri Dec 27, 2013 2:06 pm

hi @gfigueroa
check out the following topic where i talk a bit about multiple touch inputs and I also provide an example.

Topic
Live Demo (obviously try on a touch device)
CAPX of the Demophilx2013-12-27 14:07:39
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Sat Dec 28, 2013 2:45 am

@plinkie @philx Thanks for answering!

I'm using the following code:
Touch -> Is touching PLAYER | PLAYER -> Set position to (Touch.X, Touch.Y)

This works great if you only have a Spidy (aka PLAYER) on the screen. If the user touches one and hold it, then if another PLAYER appears, and the user touches it, then it gets teleported to Touch.X, Touch.Y...

I will check the links @philx placed there and see if I can understand how to make it work properly.
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Sat Dec 28, 2013 3:06 am

@philx that is great, it does work awesome. I do have a couple of questions:
- If I understand correctly, they "teleport" to the location of the touch, because of the event 5 Touch.XForID(player1ID), how can I set it up so the they will move with your finger and not jump.

- Do you know, or have an idea, on how to apply this to objects being generated randomly? In the example, the player is always there and it does not get generated again. I'm thinking that it should be a way to track the new generated object like UID.

Thanks again!!!

@plinkie it would be also great if you know, or have an idea for this :)

Thanks!
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Sat Dec 28, 2013 5:06 am

To move with your finger you'll want to experiment with the drag & drop behaviour. Add it to the one of the objects and you'll see. There are ways to have objects follow a mouse cursor but of course on a mobile this will be different so I would use a combination of teleport to touch and have the objects use drag/drop so they can be dragged around the screen.
B
46
S
15
G
73
Posts: 2,026
Reputation: 43,459

Post » Sun Dec 29, 2013 3:01 pm

@plinkie awesome, I will look into that behavior!!! Thanks so much!!!
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Mon Dec 30, 2013 4:27 pm

@gfigueroa
can you somehow put the randomly created spiders in a family and then make the events for that family?

i can't really help you more unless you provide a screenshot of your events or a capx.


since you want to port to a mobile platform aswell (like me) i have a question .. what screen size did you focus? or what aspect ratio and what scale method did you use?
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Mon Dec 30, 2013 4:42 pm

@philx I will post a capx as soon as possible :) Thanks

I have been using 16:9 because it fits the dimensions of the screen. I have been using 1920x1080. More than being concerned on the graphics size, I have the issue with the sound compression for Windows Phone, so the files gets bigger because of the WAV file (I'm using Henry's (thehen) Plugin
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Mon Dec 30, 2013 4:59 pm

@gfigueroa allright, i hope i can help you then.

ok. i think im going for 16:10 (1280x800) for Android and 4:3 (2048x1536) for iOS.
Im afraid i haven't played around with the sound fx yet. but i read alot about troubles with cocoonjs and the game's sound.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Next

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, SputnikCZ and 2 guests