Unable to game_state.attempt_spawn

I write the following lines:

destr_pos = [[5,11],[12,11],[16,11],[22,11]]
for pos in destr_pos:
if game_state.can_spawn(DESTRUCTOR,pos):
game_state.attepmt_spawn(DESTRUCTOR,pos)

but when I play with it, the log said:

AttributeError: ‘GameState’ object has no attribute ‘attepmt_spawn’

what happened?

1 Like

its spelt ‘attempt’ not ‘attepmt’. I assume this is the cause.

3 Likes

I have to admit, I chuckled a bit at this. I applaud you for not doing the same

Another thing, your attempt_spawn should be nested inside of the if statement, like this:

for pos in destr_pos:
   if game_state.can_spawn(DESTRUCTOR,pos):
      game_state.attempt_spawn(DESTRUCTOR,pos)