How do I move an object.

Get help using Construct 2

Post » Sat Mar 25, 2017 2:05 pm

Hi.
Is there anyone out there who knows how to move an object towards two angles without using gravity.
I want my object to move in a speed of 100 from the top to the bottom of the screen and in the same time i want the object to move from right to left or from left to right in a speed of 100.
example i want the object to move from the top left corner to the bottom right corner at an even speed.
I tried to set the angle at 45 but since my object is a stright line the whole line turned itself 45 degrees.
is there a way to do this?
i'm currently using bullet behavior on the object.

if something isn't clear let me know and i'll try to explain more in detail.

thanks!
B
11
S
4
G
1
Posts: 22
Reputation: 1,325

Post » Sat Mar 25, 2017 4:06 pm

The bullet behavior will always change the sprite angle to match the movement angle.

You can set the animation to a different animation so it matches the angle you want.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Sun Mar 26, 2017 7:57 am

You can use a "ghost object" that's set with bullet behaviour... then attach the "real" object to the ghost object coordinates. This way you can control the ghost object and the angle doesn't matter. The real object will be at whatever angle you tell it to be.

You could also do it simply by setting the position of your object to;

Set X: self.x+(amount of pixels)
Set Y: self.y+(amount of pixels)

You would need to figure out the amount of pixels per tick you wanted to use, in order to achieve the speed you want. Also be aware in doing is this way, you will also want to make sure you are using timedelta (dt) so that results do not vary on a slower or faster processor.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, tarek2 and 26 guests