How do I CREATE A Shooter Touch Control?

Get help using Construct 2

Post » Mon Feb 09, 2015 4:55 pm

Hi everyone,
I am trying to create a touch control for a Shooter game where you don't see the player but only the target.

What I am trying to do is to be able to control the target on the screen with a small touch control area which will be on the down left part of the screen.

So we can say there will be a small touchable area which will be a small simulated version of the main game screen. So If I touch the top right of that rectangle touch control area the target will go to the top right of the main playable area.

Please check out the image in the attachment.

Regards

Image
B
19
S
6
Posts: 179
Reputation: 2,147

Post » Mon Feb 09, 2015 8:22 pm

get the x & y of the touch in the touch area. with the x and y, you can see at what offset percentage the x & y is from the top and left of the box, and apply the same percentage offset to the target on the game area
B
21
S
4
G
1
Posts: 96
Reputation: 1,842


Post » Mon Feb 09, 2015 11:13 pm

@MrGoatsnake & @Lordshiva1948 Thank You Both So Much I will try both and see which one I will make it work it out! :)
B
19
S
6
Posts: 179
Reputation: 2,147

Post » Mon Feb 09, 2015 11:53 pm

@MrGoatsnake I thought this would be easy but just couldn't figure it out :) Could you give a little bit example if possible like how will I make the main target follow the touch on the left lower corner of the screen etc. I really couldn't figure out how to arrange the percentages.

Thanxx
B
19
S
6
Posts: 179
Reputation: 2,147

Post » Tue Feb 10, 2015 1:01 am

B
8
S
1
Posts: 8
Reputation: 342

Post » Tue Feb 10, 2015 9:00 am

@tintinibar Thank you this is useful but still not the droid I am looking for :)

It should be like a tracking pad actually. Like when the dot is on the bottom right of the big Circle, The green box should have already gone to the bottom right of the screen or vice versa. That part should be a simulator of the main big screen. so the player will be able to move the target within the small box smoothly by touching and sliding the finger over the (not Circle) the rectangle actually.

check out the gameplay from the link below.

https://www.youtube.com/watch?v=7NRGdljP22Q

Imagine the notebook computers. Instead of mouse you use the pad that comes with it but you can move the arrow within windows with that pad easily. Check the picture below.

Image
B
19
S
6
Posts: 179
Reputation: 2,147

Post » Tue Feb 10, 2015 5:23 pm

@volcank I figured you were going for a "trackpad" type functionality. when I get home from work I will try to create an example for you.
B
21
S
4
G
1
Posts: 96
Reputation: 1,842

Post » Tue Feb 10, 2015 9:37 pm

@MrGoatsnake Thank You So Much!! Waiting For it Now! :)
B
19
S
6
Posts: 179
Reputation: 2,147

Post » Tue Feb 10, 2015 9:51 pm

@volcank I have attached a .capx of a trackpad simulation. Originally I was going to do this with some trackpad boundaries represented by global variables, but it occurred to me I could do it with a sprite. Doing it relative to a sprite's boundaries means we can place the trackpad sprite anywhere on the screen and vary the size of it without messing around with too many variables.

So this works by creating a trackpad sprite with a top left origin, just like c2's layout. When a touch on the trackpad is fired, the touch's x and y distance from the trackpad's origin is recorded. Using the size of the object, you can calculate the percentage right and percentage down from the origin on the trackpad. Then you move your cursor object right and down the same percentage relative to the.

I have not tried this on a scrolling layout, so the math might need to be adjusted if you scroll in any direction. I believe adding the viewport x and y to the final amount down and right should account for scrolling. If I get some time this weekend, I might test and see how it works when the track pad is anchored and the view is moving around over the layout. Either way, this should get you going with the math!

Events:
tp1.png


Orgin placement:
tp2.png


.capx:
TrackpadDemo.capx
You do not have the required permissions to view the files attached to this post.
B
21
S
4
G
1
Posts: 96
Reputation: 1,842

Next

Return to How do I....?

Who is online

Users browsing this forum: Myrmex and 1 guest