How to catch touch event on part of screen

Get help using Construct 2

Post » Tue Sep 03, 2013 10:31 am

Hi everyone,

I want to do 2 different actions when users touch to the screen. In fact, if users touch to the top-half, it will do something while when they touch to the second-half which is the bottom-half of the screen, it will do something else.

The current solution that I used is that I have to objects on screen and set its opacity to 0. The first object covers the top-half of the screen while the second object covers the bottom-half. In this case, I just catch the event 'on touch' for each object. Unfortunately, it makes the game a little bit slow.

Is there any other method I can use?

Thanks in advance.
B
10
S
4
G
2
Posts: 36
Reputation: 2,207

Post » Tue Sep 03, 2013 10:36 am

That sounds like an efficient way of doing it, as an invisible object doesn't really do anything to performance.

The in-game lag is likely due to something else, not the touch input.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Tue Sep 03, 2013 11:43 am

Another method you could use is:

on touch
system compare two values: touch.y < windowheight/2 - action for top half

on touch
system compare two values: touch.y > windowheight/2 - action for bottom half
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 04, 2013 12:38 am

[QUOTE=LittleStain] Another method you could use is:

on touch
system compare two values: touch.y < windowheight/2 - action for top half

on touch
system compare two values: touch.y > windowheight/2 - action for bottom half[/QUOTE]

Thanks LittleStain. That was the method I was looking for. In this situation I do not need those invisible blocks to catch the touch event.
B
10
S
4
G
2
Posts: 36
Reputation: 2,207


Return to How do I....?

Who is online

Users browsing this forum: newt and 17 guests