# Is there a way to use block type code to draw a Triangle?

**URL:** <https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943>\
**Category:** Help\
**Created:** [July 28, 2020, 9:56am UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943 "2020-07-28T09:56:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackyu](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@Jackyu](https://forum.makecode.com/u/Jackyu)\
**Post date:** [July 28, 2020, 9:56am UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/1 "2020-07-28T09:56:50Z")

</div>

Hi all,

As a general way to explain the concepts of coding, such as loops, variables, is to use the block to draw a triangle picture with repeat steps (moving forward, and angles for turn). These are the common examples which are used in [code.org](http://code.org) and Scratch.

When I try to deploy the above examples into Arcade game here, I am able to find the block with drawing the line, but could not find the block with angle, so that I can draw the line in the direction of change at the point of triangle, say 120 degree.

I have done some homework before raising above, one way is to create a customized functional block from the function provided by Java script. But I am not that kind of experienced users yet, which I want to check is it a simply way to resolve the above question – use a simply block type code with angle function?

Thanks

Jack

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [July 28, 2020, 10:03am UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/2 "2020-07-28T10:03:25Z")

</div>

I dont really know how but I saw one

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [July 28, 2020, 10:08am UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/3 "2020-07-28T10:08:03Z")

</div>

This is it

> **[paint brush](https://arcade.makecode.com/71485-16425-60199-92699)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Jackyu](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@Jackyu](https://forum.makecode.com/u/Jackyu)\
**Post date:** [July 28, 2020, 4:04pm UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/4 "2020-07-28T16:04:28Z")

</div>

Thanks, but it use Java script, which is a not a idea way to do so if i like to bring this exercise to the kids. That is why i like to check is there a simply way - which just use block type.

Thanks

Jack

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 28, 2020, 4:17pm UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/5 "2020-07-28T16:17:40Z")

</div>

No, we don’t have any “turtle” blocks by default in Arcade. Would make a great extension though!

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [July 28, 2020, 5:10pm UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/6 "2020-07-28T17:10:27Z")

</div>

From the early days of arcade, [https://github.com/microsoft/pxt-screen-turtle/](https://github.com/microsoft/pxt-screen-turtle/)

Needs refreshing.

---

<div class="post-metadata">

**Author:** ![Jackyu](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@Jackyu](https://forum.makecode.com/u/Jackyu)\
**Post date:** [July 29, 2020, 3:31pm UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/7 "2020-07-29T15:31:47Z")

</div>

yes, it will be great!

---

<div class="post-metadata">

**Author:** ![felixtsu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/felixtsu/32/12024_2.png) [@felixtsu](https://forum.makecode.com/u/felixtsu)\
**Post date:** [July 30, 2020, 3:32am UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/8 "2020-07-30T03:32:15Z")

</div>

After

1. Fixing a tiny typo in setPosition()
2. Changing screen dimension to 160 \* 120, (@peli, wondering why the original was 4 \* 4, just to make sure I didn’t miss anything. 🙃)
3. Adding rightTurn() / leftTurn() / clearScreen() ( Still remember using these as a kid)

And, after almost 30 years, I can still code those classic programs 😄 😄 😄

> **[test screen-turtle](https://arcade.makecode.com/83608-92560-75080-22334)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

The extension repo is here if you would like a quick look @Jackyu

> **[felixtsu/pxt-screen-turtle](https://github.com/felixtsu/pxt-screen-turtle)**
>
> A LOGO turtle implementation using the MakeCode screen support - felixtsu/pxt-screen-turtle

I’ve created a [pull request](https://github.com/microsoft/pxt-screen-turtle/pull/1).

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 30, 2020, 6:36pm UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/9 "2020-07-30T18:36:13Z")

</div>

I’m guessing it was 4x4 because it was forked from the micro:bit turtle extension…

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [July 30, 2020, 7:56pm UTC](https://forum.makecode.com/t/is-there-a-way-to-use-block-type-code-to-draw-a-triangle/2943/10 "2020-07-30T19:56:27Z")

</div>

Great thanks for the fixes! I’ve merged and pushed a release --\> [https://microsoft.github.io/pxt-screen-turtle/](https://microsoft.github.io/pxt-screen-turtle/)
