How do I move an object.

0 favourites
  • 3 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • 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!

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)