How do I make sprite move left and right

Get help using Construct 2

Post » Wed Apr 01, 2015 1:40 pm

How do I make touch control to make sprite move left and right only
B
62
S
22
G
12
Posts: 210
Reputation: 10,142

Post » Wed Apr 01, 2015 1:43 pm

Hi Abdalghani,

Did you try to use the "Custom Movement" behavior ?

You can use it to make go left or right when a key is pressed.
B
24
S
5
Posts: 42
Reputation: 1,286

Post » Wed Apr 01, 2015 1:46 pm

I wanna do it by touch control
B
62
S
22
G
12
Posts: 210
Reputation: 10,142

Post » Thu Apr 02, 2015 4:43 pm

compare your Sprite.X with Touch.X
if Touch.X < Sprite.X == move left
if Touch.X > Sprite.X == move right
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
64
S
14
G
3
Posts: 293
Reputation: 7,210

Post » Thu Apr 02, 2015 6:06 pm

Use the "Custom Movement" behavior to the sprite and "On Touch objet" == Sprite , "simulate control"
B
43
S
12
G
3
Posts: 111
Reputation: 4,418

Post » Fri Apr 03, 2015 4:35 am

Thank you for helping
B
62
S
22
G
12
Posts: 210
Reputation: 10,142

Post » Fri Apr 03, 2015 12:58 pm

I'd probably use 8 directional movement and then compare the touch.x to the object.x and if it is was not equal have it simulate movement. However in my game I made like this I believe I decided to not want it to go to the dead center of the object so I used two vents to check if it was greater then object.x+32 and a second event to check if it was less then object.x -32 or something along those lines.
B
6
S
2
G
1
Posts: 34
Reputation: 1,101

Post » Sat Apr 04, 2015 5:46 am

there are many way to make control touch ( left and right) . thanks
B
62
S
22
G
12
Posts: 210
Reputation: 10,142


Post » Sun Apr 05, 2015 4:25 am

Thank you
B
62
S
22
G
12
Posts: 210
Reputation: 10,142

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests