VBAndCs / sVB-Small-Visual-Basic

Small Visual Basic (sVB) is an educational programming language, created by Eng. Mohammad Hamdy as an evolved version of Microsoft Small Basic (SB). It is meant to be easier and more powerful at the same time, to introduce programming basics to kids and beginners of any age, provided that they can use the English keyboard on the Windows OS.
Other
222 stars 16 forks source link

Drawing a x-pointed star with thick lines and correct points ... #31

Closed boa2145 closed 1 year ago

boa2145 commented 1 year ago

Hello Mohammad,

I want to draw a five-pointed star with thick lines and I have the problem, that I cannot draw such a star with correct points at the ends. So I enclose two screenshots with turtle programming via sVB and via Python. You see the different ends of the lines. Is it possible to draw a five-pointed star with correct points?

Regards ... Gregor

sVB: FiveStar_sVB

Python: FiveStar_Python

VBAndCs commented 1 year ago

@boa2145 Yes. Fill the figure, and it will be fixed! And don't ask me Why! You can fill the figure with a transparent color if you want:

Jags = 5
Turtle.X = 300
Turtle.Y = 300
Turtle.Speed = 30
GW.PenWidth = 20
Turtle.CreateFigure()
For I = 1 To Jags
   Turtle.Move(100)
   Turtle.Turn(2 * 360 / Jags)
   Turtle.Move(100)
   Turtle.Turn(-360 / Jags)
Next
GraphicsWindow.BrushColor = Colors.Transparent
Turtle.FillFigure()

image

boa2145 commented 1 year ago

Good morning Mohammad,

Thanks for your reply with the source code and its output. I didn't know that I can fill a shape with a transparent color. That's great, but there was still a tiny mistake. I enclose two pics to demonstrate it. If you hide the turtle at the end of the source code, you'll see it. I found a solution. You have to add a last move by the turtle outside of the loop with the same length and it was fixed.

Yesterday I coded the flag of Marocco. This flag has one five star with a thick green line in the middle of it. With this fixed five star I can complete my exercise with sVB and your important help. 👍 With Small Basic it is not possible to draw an exact five star.

Regards ... Gregor

Your source code: Your Source Code

The output of your source code: Your FiveStar

My added source code: Added Source Code

The output of my added source code: Corrected FiveStar