# How to draw a line between 2 points

**URL:** <https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717>\
**Category:** Help\
**Created:** [February 6, 2024, 7:32pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717 "2024-02-06T19:32:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [February 6, 2024, 7:32pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/1 "2024-02-06T19:32:55Z")

</div>

I want to have 2 points have a (preferably) editable line that i can make appear and disappear Like a

So sprite 1  
And sprite 2  
have a line that moves with them  
like a rope connecting them that can be toggled

---

<div class="post-metadata">

**Author:** ![Mr.Someone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mr.someone/32/23300_2.png) [@Mr.Someone](https://forum.makecode.com/u/Mr.Someone)\
**Post date:** [February 6, 2024, 10:23pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/2 "2024-02-06T22:23:02Z")

</div>

You can draw lines if you go under the advanced category, and then go to “Images”  
Here’s an example:

> **[Line](https://arcade.makecode.com/S12815-70895-32101-09374)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [February 6, 2024, 10:26pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/3 "2024-02-06T22:26:54Z")

</div>

Use sprite util render on screen block  
If sprites exist then  
Draw line from sprite1 pos to sprite 2 pos on screen  
(this method allows you to adjust the z value of the line as well)

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [February 7, 2024, 6:24pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/4 "2024-02-07T18:24:38Z")

</div>

> [@Luke](#):
>
> render on screen

So i got that working how do i make it stop?

> **[Hooktest](https://arcade.makecode.com/S86436-39791-66335-07545)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Press A to start throwing and B to Throw

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [February 7, 2024, 7:05pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/5 "2024-02-07T19:05:24Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/5ccaa98647d3d50aa73a9ba0e4523e4ce6339e73.png)  
If you change the variable to false it should just stop rendering

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [February 7, 2024, 7:37pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/6 "2024-02-07T19:37:42Z")

</div>

Well you see i did that and it still renders

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [February 7, 2024, 8:03pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/7 "2024-02-07T20:03:55Z")

</div>

Well somehow you’re using the dart sprite as the bool (idk why that didn’t trigger an error). To fix it use a new bool variable and make sure to toggle it at the right moments

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [February 8, 2024, 7:45pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/8 "2024-02-08T19:45:54Z")

</div>

> [@Luke](#):
>
> idk why that didn’t trigger an error

You can pass in any datatype and it is automatically converted to boolean for checking

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [February 8, 2024, 9:31pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/9 "2024-02-08T21:31:37Z")

</div>

> **[Hooktest2](https://arcade.makecode.com/75715-86889-45707-87096)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Ok so now when you move the cam it doesnt move the line

after you hook you can move left right and move up down too  
press B to release the hook

---

<div class="post-metadata">

**Author:** ![Mr.Someone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mr.someone/32/23300_2.png) [@Mr.Someone](https://forum.makecode.com/u/Mr.Someone)\
**Post date:** [March 13, 2024, 12:21am UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/10 "2024-03-13T00:21:05Z")

</div>

I’m having the same problem with the camera, can someone help?

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [March 13, 2024, 12:25am UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/11 "2024-03-13T00:25:13Z")

</div>

Send code pls (@MakeCode can you make this a message that pops up when people ask for help?)

---

<div class="post-metadata">

**Author:** ![Mr.Someone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mr.someone/32/23300_2.png) [@Mr.Someone](https://forum.makecode.com/u/Mr.Someone)\
**Post date:** [March 13, 2024, 6:21pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/12 "2024-03-13T18:21:28Z")

</div>

> **[Grappling Gun Glenda](https://arcade.makecode.com/S12815-70895-32101-09374)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Josef](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/josef/32/12457_2.png) [@Josef](https://forum.makecode.com/u/Josef)\
**Post date:** [March 27, 2024, 1:43pm UTC](https://forum.makecode.com/t/how-to-draw-a-line-between-2-points/26717/13 "2024-03-27T13:43:14Z")

</div>

Nice!
