Buttons access like an array
Posted: Saturday 16th February 2019 6:12pm
==Newbie - programmed in visual basic for a while, Just installed Gambas3
I am writing a game where one of the elements is a 5 x 5 array. The elements in this array are placed by the player and are represented as buttons on the play field. I would like to refer to these button as field[x,y] where x and y number 1 to 5 (I will also be using x=0 for a stack of oncoming play items, so x=0 to 5 and y = 1 to 5 where x will represent distance left to right across the screen, and y= up and down:
|0,1| |1,1||2,1||3,1||4,1||5,1|
|1,2| |1,2||2,2||3,2||4,2||5,2|
Can I name my buttons field[0,1] or something like that, and be able to display something on button 1,2 with : x=1
y=2
field[x,y].text = "[$]"
Which would set the label on the button to [$]
Thanks for your help - sorry if this is not for getting help..
I am writing a game where one of the elements is a 5 x 5 array. The elements in this array are placed by the player and are represented as buttons on the play field. I would like to refer to these button as field[x,y] where x and y number 1 to 5 (I will also be using x=0 for a stack of oncoming play items, so x=0 to 5 and y = 1 to 5 where x will represent distance left to right across the screen, and y= up and down:
|0,1| |1,1||2,1||3,1||4,1||5,1|
|1,2| |1,2||2,2||3,2||4,2||5,2|
Can I name my buttons field[0,1] or something like that, and be able to display something on button 1,2 with : x=1
y=2
field[x,y].text = "[$]"
Which would set the label on the button to [$]
Thanks for your help - sorry if this is not for getting help..