[SOLVED]Make an object move through a fixed and random track

0 favourites
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • Hi C2 developers! ^^

    I would like to hear from you what is the best way to make an object not controlled by the player move linearly through a predetermined track.

    I managed to do here through waypoints together with the MoveTo behavior, but it's not perfect, because I need that to move objects in a perfect line between the waypoints without small deviations. It is worth mentioning that my game uses isometric perspective (30 degrees), then the difficulty is greater. Furthermore, there are waypoints in stage 5 to move the object from point A to B.

    HOW TO IMPLEMENT THE RANDOM TRACK?

    Now I'm trying to implement an alternative random paths system to a game based on the simple_path_follow.capx posted in this thread by

    https://dl.dropboxusercontent.com/u/542 ... ollow.capx

    I'm trying to do this:

    I believe that the right way to do this is by identifying the black circles through UID, but I cannot implement it. For this, I left the black dots that make up the parallel paths with equal values in the variable "n".

    So I tried (unsuccessfully) to do their own event to redirect the avatar, making the following changes:

    Object move at angle: move min(Self.speed*dt, Self.dist2target) pixels at angle angle(self.X,Self.Y,Dot(choose(30,31)).X,Dot(choose(30,31)).Y)

    Object subtract from: subtract Self.speed*dt from dist2target

    EDIT:

    RANDOM TRACKS SYSTEM IMPLEMENTED BY blackhornet, through LiteTween. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    http://www.blackhornettechnologies.com/ ... k_BHT.capx

    LiteTween: viewtopic.php?t=70700&start=0

    Thanks in advance the attention and collaboration of all. ^^

  • Master R0J0hound, can you help this padawan here? ^^

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you give a picture of your game? Its would be easier to understand what you need.

  • Sure, ^^

  • These black dots in the track are the waypoints that the kid (out of the grid) gonna follow in this stage.

    As I said before, I'm using MoveTo now to do the track movement, but it isn't perfect. Maybe its a collision problem, I don't know.

  • So, hero can walk only through points?

    I think this might help in this case, my last message - https://www.scirra.com/forum/viewtopic.php?f=147&t=147611&p=938715#p938715

    Look at the enemies.

  • Exactly,

    Your CAPX is a good exemple and a good job, but I need something more specific, due to the format of my game.

    Thanks for your collaboration. ^^

  • Well, you'll still have to use "pathfinding" behavior. Just in a different way, 'cause i see - you want your player move by the grid.

    It's seems simple (But that is always like that 'til you get to it), so i'll try figure something out, but cannot promise anything.

    And i need exact size of your grid.

  • Thanks one more time, XpMonster. ^^

    The image size of the Grid is 816x473.

  • Not in total. Just one block -

  • Alright, it's 40x26.

  • What kind of movement do you need? (Those red points i added as example. Player do not uses them to move)

    That one?

    ------------------------

    Or that?

  • As the first image,

    But I note that the grid is invisible on stage. Then I think both are useful for what I want. ^^

  • lukezero

    The fact it's isometric doesn't make it any different to regular path following.

    Here's a way to do it:

    https://dl.dropboxusercontent.com/u/542 ... ollow.capx

    It just moves toward the next waypoint. At the start and when the targeted waypoint is changed the distance is calculated in a variable. As the sprite move the distance is reduced by the same amount, and when the distance variable becomes negative we know the waypoint was passed so we target the next waypoint.

  • lukezero

    The fact it's isometric doesn't make it any different to regular path following.

    Here's a way to do it:

    https://dl.dropboxusercontent.com/u/542 ... ollow.capx

    It just moves toward the next waypoint. At the start and when the targeted waypoint is changed the distance is calculated in a variable. As the sprite move the distance is reduced by the same amount, and when the distance variable becomes negative we know the waypoint was passed so we target the next waypoint.

    Great example, great R0J0hound, mainly because you didn't use any behavior to do so.

    Thanks one more time for your collaboration! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

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