Questions about movements and angle

0 favourites
  • Hey! I'm developing an age of empires survival style game, and my unit sprites will have animations in 8 directions, do I need that when I select these animations to move on the map, the animations match the angle that the units are moving? what is the best behavior for this, MoveTo or 8direções?

    and I would also like to know how I would make the units, when selected, move all together like in age of empires?

    Tagged:

  • If you are controlling the character with keyboard keys, then 8direction will be the best choice. Otherwise you can use MoveTo or Pathfinding (if there are obstacles and units should walk around them).

    Check out this example:

    editor.construct.net

    All these behaviors have MovingAngle expression, which you can use to set the correct animation. See these tutorials:

    construct.net/en/tutorials/animation-management-8-712

    construct.net/en/tutorials/direction-based-sprite-251

  • If you are controlling the character with keyboard keys, then 8direction will be the best choice. Otherwise you can use MoveTo or Pathfinding (if there are obstacles and units should walk around them).

    Check out this example:

    https://editor.construct.net/#open=pathfinding-groups

    All these behaviors have MovingAngle expression, which you can use to set the correct animation. See these tutorials:

    https://www.construct.net/en/tutorials/animation-management-8-712

    https://www.construct.net/en/tutorials/direction-based-sprite-251

    Hey! I'm trying to make the movement fit the pathfinding angle but it's very confusing to understand, here's my project mega.nz/file/vIgiFBYS

  • If you are controlling the character with keyboard keys, then 8direction will be the best choice. Otherwise you can use MoveTo or Pathfinding (if there are obstacles and units should walk around them).

    Check out this example:

    https://editor.construct.net/#open=pathfinding-groups

    All these behaviors have MovingAngle expression, which you can use to set the correct animation. See these tutorials:

    https://www.construct.net/en/tutorials/animation-management-8-712

    https://www.construct.net/en/tutorials/direction-based-sprite-251

    Hey! can you help me with these angles?

  • When moving angle between -45 and 45 : "right" animation

    Between 45 and 135: "down"

    Between 135 and 225: "left"

    Between 225 and 315: "up"

  • When moving angle between -45 and 45 : "right" animation

    Between 45 and 135: "down"

    Between 135 and 225: "left"

    Between 225 and 315: "up"

    i'm really not very good at math, i was trying to do the angle calculation in construct 3 which is different from a 360 ruler so i was struggling, thanks for helping me get my mind to work now i really got it working the angle in c3 and managed to do the calculations, God bless you

  • dop2000

    Thanks man, now I need to know how I do it so that when I select several of the same unit, they move in groups side by side the same in age of empires

    media.moddb.com/cache/images/mods/1/24/23053/thumb_620x2000/New15.png

  • This is difficult. Try searching the forum, many people have asked this question.

    I have a couple of examples, but they are quite complicated and not very good.

    howtoconstructdemos.com/avoid-overlapping-while-moving-with-pathfinding

    howtoconstructdemos.com/prevent-multiple-enemies-with-pathfinding-from-overlapping-easystarjs

  • This is difficult. Try searching the forum, many people have asked this question.

    I have a couple of examples, but they are quite complicated and not very good.

    https://howtoconstructdemos.com/avoid-overlapping-while-moving-with-pathfinding/

    https://howtoconstructdemos.com/prevent-multiple-enemies-with-pathfinding-from-overlapping-easystarjs/

    Thanks for the examples I will study them.

    I managed to solve the 8-way angle problems, I need help solving this problem, I have 32-frame angle units, this image turret needs to adjust the frames along with the rotation of the "Turret" behavior, how can I do this?

  • Try something like this:

    Set animation frame to round(((a+360)%360)/32)%32

    Where a is the turret angle.

  • Try something like this:

    Set animation frame to round(((a+360)%360)/32)%32

    Where a is the turret angle.

    Hey! I did it the way you taught me but it's not working, the frames are all messed up and don't fit the angle

  • You can't rotate the same sprite!

    The rotating turret sprite should probably be invisible. And then there is another sprite on top of it, which is playing the rotating animation.

  • You can't rotate the same sprite!

    The rotating turret sprite should probably be invisible. And then there is another sprite on top of it, which is playing the rotating animation.

    in fact the cannon is positioned on top of the tank and what is rotating is the cannon itself, really i don't know what's wrong

  • The turret sprite (which is rotating) should be invisible.

    The animation sprite (with 32 frames) should be on top of the turret, and should not rotate.

    The "a" in my formula is the angle of the turret sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The turret sprite (which is rotating) should be invisible.

    The animation sprite (with 32 frames) should be on top of the turret, and should not rotate.

    The "a" in my formula is the angle of the turret sprite.

    I understand what you mean with an invisible sprite to run with a turret and the cannon goes on top visible, I tried your method but the angle still didn't work, the frames were messed up, I did this:

    + System: For each Tank1_Arm

    + Tank1_ArmTurret: ArmUID = Tank1_Arm.UID

    -> Tank1_Arm: Set animation frame to round(((Tank1_ArmTurret.Angle + 360) % 360) ÷ (360 ÷ 32)) % 32

    it worked but there is always a frame late

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