Minggu, 22 Maret 2020

SMALL BASIC: Drawing random astrological sign

Hi, Small Basic Programmer, welcome.

In this tutorial we will learn how to make random astrological sign each run:

This is much like toddler draws random sign.

Below is the code:

GraphicsWindow.Show()
GraphicsWindow.Width = Desktop.Width
GraphicsWindow.Height = Desktop.Height
GraphicsWindow.Top = 0
GraphicsWindow.Left = 0

numb_of_vertex = Math.GetRandomNumber(10)
For i = 0 To numb_of_vertex
  size_w = Math.GetRandomNumber(10)
  size_h = Math.GetRandomNumber(10)
  shapes[i] = Shapes.AddEllipse(size_w, size_h)
  pos_x[i] = Math.GetRandomNumber(Desktop.width)
  pos_y[i] = Math.GetRandomNumber(Desktop.height)
  shapes.move(shapes[i],pos_x[i],pos_y[i])
  shapes.AddLine(pos_x[i],pos_y[i],pos_x[i-1],pos_y[i-1])
EndFor
  

Tidak ada komentar:

Posting Komentar