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
46
S
14
G
10
Posts: 198
Reputation: 7,896

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
11
Posts: 32
Reputation: 437

Post » Wed Apr 01, 2015 1:46 pm

I wanna do it by touch control
B
46
S
14
G
10
Posts: 198
Reputation: 7,896

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
54
S
13
G
2
Posts: 282
Reputation: 6,216

Post » Thu Apr 02, 2015 6:06 pm

Use the "Custom Movement" behavior to the sprite and "On Touch objet" == Sprite , "simulate control"
B
40
S
9
G
2
Posts: 111
Reputation: 3,648

Post » Fri Apr 03, 2015 4:35 am

Thank you for helping
B
46
S
14
G
10
Posts: 198
Reputation: 7,896

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
1
G
1
Posts: 31
Reputation: 945

Post » Sat Apr 04, 2015 5:46 am

there are many way to make control touch ( left and right) . thanks
B
46
S
14
G
10
Posts: 198
Reputation: 7,896

Post » Sat Apr 04, 2015 2:50 pm

Learn more with demos:
https://www.dropbox.com/home/Demos
B
218
S
30
G
14
Posts: 1,889
Reputation: 37,578

Post » Sun Apr 05, 2015 4:25 am

Thank you
B
46
S
14
G
10
Posts: 198
Reputation: 7,896

Next

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 1 guest