How do I move an sprite up/down on touch?

0 favourites
  • 9 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hello!

    Noob alert here!

    I'm just getting started with a mobile concept I have, and I'm stumped at the first hurdle

    I would like to tap on the left of the block to move the block up smoothly, like a jump and tap on the right of it to make it fall to ground quickly.

    I'd applied 8-direction behaviour to the block, and added a touch object and added to empty sprites as the touch target objects.

    In the event sheet I am looking for a touch on the objects and then setting either the Sprite.Y position to it's normal position, or 200 pixels above and I duplicated the same for mouse for testing in browser.

    However, nothing happens! If I add another action like to set a negative gravity it works, so I can see the touch/mouse events are firing, they're just not moving my block!

    Hopefully it is just something dumb on my part, my project is attached.

  • Your instructions are a bit vague as to the result you are after. There are many ways to move a Sprite around, and a few plugins that help a lot too (litetween, easetween, moveto).

    Since you used the Physics Plugin, here is an example capx that acts the way I interpret your post.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    Thanks for your response. Sorry I didn't feel they were vague instructions!

    Simply, when the left side is tapped I want the green block (Sprite2) to jump 'up' smoothly by 200 pixels. Then if the right side is tapped it will return to its normal position.

    In other words, tap the left side of the screen to jump, tap the right to cancel your jump.

    Unfortunately I cannot use your file because it is from a newer version.

  • It's not that I don't get the concept, it's just that I don't get the term "Jump" that you use. I interpret it like in a platformer game, meaning that the beginning of the movement is abruptly fast and it gradually stops. Then you say to fall in the ground quickly. Quickly compared to what? To the time it took for it to go up, or with out the deceleration? Like a linear movement..?

    Anyway, you should update to the latest stable version (175) and try the capx, it's a starting point. Also, search the forum for the plugins I mentioned, perhaps they will help you, if not on this project then surely somewhere else.

  • Yes, jump like platformer, and return quickly compared to the time taken to jump up.

    The help needed is more what to use to get the object to move, as clearly I am not using the right things if nothing is happening in my uploaded project. The quickness can all be adjusted as they're just variables after all and this is my first attempt at this software and making a game so I am not familiar with what things have what affect on my objects.

    The latest stable is 173. 175 is the beta.

    I will try the plugins you mention.

  • You are right. 173 is the latest stable, my bad, sorry! If you do update to the version 175 however, here is an example with the simplest way I can think off, without using any plugins.

  • try setting your TapUp to a negative number. Y values are smaller at the top and bigger at the bottom.. so I think you've basically got both buttons going down.

  • You are right. 173 is the latest stable, my bad, sorry! If you do update to the version 175 however, here is an example with the simplest way I can think off, without using any plugins.

    hanks, I have done so and yes this is a good start point for what I am after, I can take it from here I think!

    Thanks for your help.

  • You are welcome! Fiddle around with it and if you come up with something else just ask.

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