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

Just started using Construct 2? Post your questions here

Post » Tue Jul 29, 2014 6:38 pm

Hello!

Noob alert here!

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

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.
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 6
Reputation: 175

Post » Tue Jul 29, 2014 8:22 pm

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.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Tue Jul 29, 2014 8:29 pm

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.
B
3
Posts: 6
Reputation: 175

Post » Tue Jul 29, 2014 8:42 pm

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.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Tue Jul 29, 2014 9:01 pm

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.
B
3
Posts: 6
Reputation: 175

Post » Tue Jul 29, 2014 9:46 pm

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.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed Jul 30, 2014 3:22 am

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Wed Jul 30, 2014 6:09 pm

eli0s wrote: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.
Thanks, 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.
B
3
Posts: 6
Reputation: 175

Post » Wed Jul 30, 2014 6:33 pm

You are welcome! Fiddle around with it and if you come up with something else just ask.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests