0

So i am making a small homework assignment that should draw a cloud (its kinda wierd but doesn't matter. And i need a variable to choose between 2 other variables like this:

A = 1
B = 2

C = A or B

I thought about using an array but is do not really understand them.

PX_P = PX_1 + Math.GetRandomNumber(300) + 50
PX_N = PX_1 - Math.GetRandomNumber(300) + 50
PY_P = PY_1 + Math.GetRandomNumber(150) + 50
PY_N = PY_1 - Math.GetRandomNumber(150) + 50

PX_2 = (PX_2 should either be PX_P or PX_N)
PY_2 = (PY_2 should either be PY_P or PY_N)
GraphicsWindow.DrawEllipse((PX_2), (PY_2), (SX_2), (SY_2))
GraphicsWindow.FillEllipse((PX_2), (PY_2), (SX_2), (SY_2))
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

2 Answers2

0

Create a list and using Math.GetRandomNumber() Get an value

list[1] = PX_P
list[2] = PY_N
PX_2 = list[Math.GetRandomNumber(2)]
PY_2 = list[Math.GetRandomNumber(2)]
Roshan
  • 664
  • 5
  • 23
0

You could use this code:

A = 1 'Set the A variable
B = 2 'Set the B variable
num = Math.GetRandomNumber(2) 'Gets a random number between 1 and 2
If num = 2 Then
  C = A
Else
  C = B
EndIf
CodeAlong
  • 1
  • 3
  • I know this probably isn't what you are asking for, but it works with 2 variables. Unfortunately, small basic doesn't support transparency, except for arrays, which you mentioned you didn't want to use. – CodeAlong Jun 19 '21 at 18:10