Making a line between two objects

  • So, I'm making a platformer where the character can shoot out this projectile which moves at a set speed, and after getting a certain distance away from the character returns to the character, and if it hits a wall before reaching said distance it will trigger an event.

    I don't have any problems there, but I want to add an adaptive tiled line which, while the projectile is in the air, will have one end attached to the projectile, and the other end following the player around, so it will have to change size and angle depending on how far away and in what direction it is from the player.

    Basically, I want Terraria's grappling hook, if you happen to know how that works.

    In the likely case my current explanation makes zero sense, I put an image below. Imagine the line is tiled, and each tile is represented by a number in that image. When I press space, it shoots out the blue thing towards the cursor, and the 1 follows behind, then 2, 3, etc. The highest number that is out is next to the player, and all numbers form a line between the player and the blue thing. Once 10 tiles are out, the blue thing starts going back towards the player, and the numbers go back in.

    So if you've understood what I'm on about and have an idea as to how to program this line, that would be very helpful. Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Something like this?

    https://www.dropbox.com/s/6drs0fiqhkcdzag/TiledLine.capx?dl=0

    That worked impeccably, thanks!

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