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
233 stars 16 forks source link

[Proposal] Allow the turtle to fill area with color #10

Closed VBAndCs closed 1 year ago

VBAndCs commented 1 year ago

Suggested by @boa2145 I'll study your sVB reference, but it will take me a while to get there. Small Visual Basic is probably much more powerful than Small Basic. I've already seen that sVB also has arguments and parameters using procedures, which I really miss in Small Basic. As a result, there are local and global variables in sVB, which makes programming much more interesting and easier.

Is it possible for you to expand the skills of turtle programming at sVB? If you look at the turtle module called "turtle" for Python, you'll see that there are many more methods there. This makes it possible to use "begin_fill" and "end_fill" to easily mark the area of the source code that is later to be filled with color. This doesn't work with Small Basic. You can only draw lines, but it is not possible to fill the forms with colors. I would love it if you could extend the power of turtle programming for sVB. This would give you many more options when programming the turtle.

It's great that you have further developed Small Basic and that there is also a thick manual for it. You will have invested a lot of work. Respect!!!

Kind regards from Germany ... Gregor

VBAndCs commented 1 year ago

@boa2145 Thanks Gregor for your great suggestion. I think it may be possible to fill the shape drawn by the turtle, by defining a geometric path for the segments it draws, the same way used to draw the pentagon. I will consider it in next releases. Thanks.

VBAndCs commented 1 year ago

@boa2145 It's done. You can install sVB v2.8.4, where you can use the turtle can fill an area, by calling the CreateFigure and FillFigure methods.

X = Turtle.X
Y = Turtle.Y

Turtle.CreateFigure()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.FillFigure()

Turtle.CreateFigure()
Turtle.TurnLeft()
Turtle.Move(200)
Turtle.MoveTo(200, 200)
Turtle.MoveTo(350, 200)
Turtle.MoveTo(X, Y)
GraphicsWindow.BrushColor = Colors.Red
Turtle.FillFigure()

image