Android Question error trying to move a box around the screen randomly

wwregistry

Member
Licensed User
Longtime User
How would I make this code work?
I am trying to move a box around the screen randomly.
This throws a math error "59%x"
Sub BlipRun
Dim x As String
Dim y As String
Dim w As String
Dim h As String

w = 1%x
h = 1%y

x = Rnd(1, 100) & "%x"
y = Rnd(1, 100) & "%y"

Blip.left = x
Blip.Top = y
Blip.Width = w
Blip.Height = h

End Sub
 

wwregistry

Member
Licensed User
Longtime User
Thanks Erel I did know of the PerXToCurrent function - very useful.

I finally solved it another way:
B4X:
x = Rnd(1, 100%x)
y = Rnd(1, 100%y)
 
Upvote 0
Top