How to get POS between 2 sprites at 3rd's Ypos?

0 favourites
  • 4 posts
From the Asset Store
Build your map with these isometric objects and terrains
  • So I've been messing with that fake 3d engine and I've hit a math snag.

    I need to find the position between 2 sprites at a third sprites y position.

    say you have a gird:

    | | | | | | | | | |

    And I Want a sprite to follow an imaginary line between two of these lines:

    | | |o| | | | | | |

    How do I calculate the pos between the 2 line sprites at the object sprites y pos?

    I've tried the "distance(spriteline1.x,spriteobj3.y,spriteline2.x,spriteobj3.y)" but I'm not even sure if thats what I need here or if that is even correct.

    Thanks for the help in advance, I've been stuck on this one for two days...

    Chris

  • Did you try lerp(a,b,x)?

    lerp(sprite1.X, Sprite2.X, 0.5) shoud put your sprite between

    file.capx

  • Thanks shinkan, that was part of the problem. But that is getting the position between of the first and second sprites origin point which is dead centre of the screen.

    The two gridline sprites get further apart as they reach the bottom of the screen. The 3rd sprite travels towards the bottom of the screen.

    I need to know what the position is between the first two sprites according to the third sprites Y location.

    That position would then become the third sprites X position. Causing it to travel on an angle according to the two grid sprites.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Never mind - ditched this for "move at angle" instead. Now the sprites do what I want but I forgot c2 rotates the sprites with the angle...ARGH!!! Invisible place holder sprites are going to cut into the speed :( Fingers crossed.

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