How do I CREATE A Shooter Touch Control?

0 favourites
  • 14 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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

  • 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

  • MrGoatsnake & Lordshiva1948 Thank You Both So Much I will try both and see which one I will make it work it out!

  • 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

  • tintinibar Thank you this is useful but still not the droid I am looking for <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    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.

    Subscribe to Construct videos now

    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.

  • 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.

  • MrGoatsnake Thank You So Much!! Waiting For it Now!

  • 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:

    [attachment=1:3jqialfb][/attachment:3jqialfb]

    Orgin placement:

    [attachment=0:3jqialfb][/attachment:3jqialfb]

    .capx:

    [attachment=2:3jqialfb][/attachment:3jqialfb]

  • MrGoatsnake Hmm thank you so much. I couldn't open the file since I have r195 but I might upgrade for this file maybe. I will try to apply from the images you attached first and see if it works. Thank you so much for your time and help. I appreciate.! I will share with you the results If I can adapt it in a game

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh yeah I forgot to mention I was on latest beta.

  • No problem i will find a way thank you oncr again.

  • MrGoatsnake Hi I have written another post about my HUD problem in another forum but also wanted to share with you. I would appreciate if you could have a look at it. I am really going nuts with this situation!!!

    Please check:

    Kind Regards

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