# How do I move an object forming an imaginary rectangle.

Just started using Construct 2? Post your questions here

### » Fri Jul 18, 2014 3:51 pm

Hello there!

I want to make an object Realize a route as follows:

O---O
| |
O---O

O--->Object

So forming an imaginary rectangle.
How can I do?

@brunopalermo
B
47
S
12
G
5
Posts: 124
Reputation: 6,851

### » Fri Jul 18, 2014 4:05 pm

Sorry don't understand. Give me more detail plz
B
269
S
52
G
16
Posts: 2,045
Reputation: 44,140

### » Fri Jul 18, 2014 4:26 pm

I made a diagram to better understand

B
47
S
12
G
5
Posts: 124
Reputation: 6,851

### » Fri Jul 18, 2014 4:48 pm

Something like this would work:

give the sprite 8 direction behaviour set to 4 directions
give the sprite an instance variable Direction

Sprite if variable direction = 1 - simulate pushing right
Sprite if variable direction = 2 - simulate pushing down
Sprite if variable direction = 3 - simulate pushing left
Sprite if variable direction = 4 - simulate pushing up

sprite compare x = more than 400 <-- (or whatever number you want)
sprite if variable = 1 - sprite set variable to 2

sprite compare y = more than 400
sprite if variable = 2 - sprite set variable to 3

sprite compare x = less than 100
sprite if variable = 3 - sprite set variable to 4

sprite compare y = less than 100
sprite if variable = 4 - sprite set variable to 1
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Sat Jul 19, 2014 8:21 am

You mean something like this
You do not have the required permissions to view the files attached to this post.
B
269
S
52
G
16
Posts: 2,045
Reputation: 44,140

### » Sat Jul 19, 2014 11:11 pm

Much like the movement I want to achieve @Lordshiva1948
Only I want you to form 90 degree angle between straight and straight.
B
47
S
12
G
5
Posts: 124
Reputation: 6,851

### » Mon Jul 21, 2014 9:19 am

I am so sorry I still do not understand but, using Bee demo I thin you should be able to work it out. If not then give me good explanation so I would understand what really you want. Thanks
B
269
S
52
G
16
Posts: 2,045
Reputation: 44,140

### » Mon Jul 21, 2014 6:26 pm

Sorry for the delay, I was out of town for the weekend.

Is this what you're looking for?

square-motion-example.capx
You do not have the required permissions to view the files attached to this post.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

### » Mon Jul 21, 2014 6:31 pm

Or you can use THIS version to have not only square movement, but, also, rectangular. Just set horizontalDistance and verticalDistance to the same value if you want it square and to different values if you want a rectangle...

rectangular-motion-example.capx
You do not have the required permissions to view the files attached to this post.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

### » Mon Jul 21, 2014 10:54 pm

@Lordshiva1948
Excuse my poor English. I wanted to do exactly what @brunopalermo did.
Thank you very much for helping @Lordshiva1948!

@brunopalermo
Brother you are a hacker! Was that what he wanted to do!
Thank you very much!
B
47
S
12
G
5
Posts: 124
Reputation: 6,851

Next