How do i move the 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
  • HELLO FRIENDS...THE QUESTION IS THE FOLLOWING: HOW DO I MAKE AN OBJECT FOLLOW A CERTAIN PATH...I USE PATHFINDING AND IT DID NOT WORK :(

    THAT IS TO SAY THAT HE MOVES FROM POINT "A" TO POINT "B" FOLLOWING THE BLUE PATH

    IS IT POSSIBLE TO DO IT AND HOW WOULD THE EVENT BE MADE?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The first thing that comes to mind is to have an object (not visible on start), give it an instance variable and then make copies of the object that have ascending instance variables starting at 1.

    Then whatever character is moving along the path also needs an instance variable set to 0.

    Create a function

    for each pathmarker, if pathmarker.variable is equal to character.variable +1 move to pathmarker.

    on whatever trigger you want. Trigger function

    Character on collision with pathmarker. AND pathmarker.variable is equal to character.variable, set character.variable to pathmarker.variable, wait for previous, trigger Function

    There is always a better way, but this should work and allow you to create multiple paths easily enough.

    bonus point, you can also create a function that creates the path based on the location of the character.

  • You could use the timeline to make a path, or so I hear.

    Or you could put a bunch of instances of a sprite and call it “node”. The order you place the node instances will define the path. The events would look like the following. Be sure to use all caps since expressions aren’t case sensitive.

    Var t=0

    Every tick

    — add 5*dt to t

    — sprite: set x to lerp(node(int(t)).x, node(int(t)+1).x, t-int(t))

    — sprite: set y to lerp(node(int(t)).y, node(int(t)+1).y, t-int(t))

    There’s other ways I’m sure.

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