0

I am coding in Pygame Zero. I wanted to get one of the string index of

player.collidelist

I have tried using

actoer= player.collidelist[57]+player.collidelist[58]+player.collidelist[59]
print(actoer)

But an error tells me that method object is not iterable

I have tried doing the string indexing after doing

actoer= player.collidelist

but it still didn't work.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Azbojrn
  • 1
  • 1
  • What do you mean by "string index"? `collidelist` is a method, not a property. It expects an argument of a list of Rects or Actors, and it will return the index in that list of the first object it finds that collides with the instance you are calling the method on. See also: https://stackoverflow.com/questions/65222519/how-can-i-check-collisions-between-actors-in-pygame-using-actor-collidepointpo/65941566#65941566 – nigh_anxiety Mar 01 '23 at 20:04

0 Answers0