Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Robster | |
Old Version | Published before Godot 3 was released. |
Hi all,
I’m trying to do the following:
func setup_board():
for x in range(5):
board.append(['O']*5)
… but I get this error:
Invalid operands 'Array' and 'int' in operator '*'.
Can anyone point to what’s going wrong here? I understnad it’s saying something like I can’t perform a multiplication on an Array but I’m doing a python tutorial and this works in Python. In that case, how would I do it in GDScript? I should probably note that I’ll be replacing ‘O’ with a sprite in time. This is just a quick prototype.
BTW, in Python this is the output and what I’m basically trying to achieve:
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
Any advice greatly appreciated.