How to perform an action with the condition that the touch

0 favourites
  • 12 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • I want to divide my screen into two sections of touch, one half moves to object 1 and the other half moves to object 2. what I can think of is to indicate the dimensions in which I can touch the screen to move objects, but I need to know how Create the condition

  • Assuming you know how to add touch:

    Conditions: Is In Touch (or whatever touch trigger you want to use) & Compare two variables (found in system)

    Assuming you are splitting the screen length wise:

    (left side of screen)

    Var 1, you want to use Touch.x

    < (switch this for right side of screen)

    Var 2, half the margin size

  • I do not understand how to add the condition.

    I would like someone to send me an example of how.

  • You can send me a screenshot please, I would appreciate it very much. What happens is that it gives me error to open your example that you sent me since I have version 227

  • Here you go, its a large picture so I just put it on dropbox, I don't think you have to download it though.

    https://www.dropbox.com/s/mvhi4a7kaliyx ... t.png?dl=0

  • Just a reminder the system condition is "Compare Two Variables"

  • great!!! I worked. But now I have another problem, my object is solid and I have a solid floor, and when I move it with the touch does not stop on the floor, it looks like q was a sprite without solid state.

    Has to do with the touch from what I see, but I do not know how to make it respect the solid state.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm trying my best to understand the type of game you're making, my guess is it is a platform. If you can better describe what you want the object to do and the environment it is in that will help me help you.

    If it is a platformer; Is this a standard platform game? meaning the floor is at the bottom of the screen.

    Are you using any behaviors for the objects?

  • What I'm doing is the game Pong, at the ends put some walls so that my rackets do not leave the screen, but with the touch if they manage to leave, does not respect their solid state.

  • What I'm doing is the game Pong, at the ends put some walls so that my rackets do not leave the screen, but with the touch if they manage to leave, does not respect their solid state.

    Okay cool, I can help. There will need to be an event that prevents the racket from going beyond a grid position,

    create another event very similar to the one I helped you with earlier.

    If the game board is 300px across and the racket is 20px with a point of origin in the center then 10px will your buffer zone, this is the excess of the racket that will go off screen. so 300 - 10 is 290 so that is how we will find the buffer for the right side of the screen. 0 + 10 is the left side buffer. This helps us make two events:

    If touch is > 290 then racket.x = 290

    if touch is < 10 then racket.x = 10

  • You've had some very good advice on here already, but alternative approach for the first problem would be to create an invisible sprite on each side of the screen abd then use on touch with which sprite is being touched to determine which side of the screen is being pressed. You can also use invisible sprite borders to stop your paddles from going off screen.

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