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
55
S
18
G
10
Posts: 209
Reputation: 8,545

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
55
S
18
G
10
Posts: 209
Reputation: 8,545

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
2
Posts: 292
Reputation: 6,678

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
11
G
2
Posts: 111
Reputation: 3,858

Post » Fri Apr 03, 2015 4:35 am

Thank you for helping
B
55
S
18
G
10
Posts: 209
Reputation: 8,545

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: 31
Reputation: 1,095

Post » Sat Apr 04, 2015 5:46 am

there are many way to make control touch ( left and right) . thanks
B
55
S
18
G
10
Posts: 209
Reputation: 8,545


Post » Sun Apr 05, 2015 4:25 am

Thank you
B
55
S
18
G
10
Posts: 209
Reputation: 8,545

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests