You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, entities[0] is just a player, but for you to know that, you need to check how the entities list is populated. Addressing a specific member of the collection based strictly on index is not considered a good practice.
The order of the array members should not be trusted!
I suggested you to use entities list as a means to print them all to screen in one loop. You should not address to specific members of array to do different stuff with them.
Better method
The state of your game is just something like that:
So, make references to player and enemyField seperate (pro-tip: make entities a dictionary!). You just need to draw() two things, which is not that much! But if that's too much, here how you can iterate over a dictionary:
PozaziemscyZaborcy/main_game.py
Line 16 in 428434b
Here,
entities[0]
is just a player, but for you to know that, you need to check how theentities
list is populated. Addressing a specific member of the collection based strictly on index is not considered a good practice.The order of the array members should not be trusted!
I suggested you to use entities list as a means to print them all to screen in one loop. You should not address to specific members of array to do different stuff with them.
Better method
The state of your game is just something like that:
So, make references to player and enemyField seperate (pro-tip: make
entities
a dictionary!). You just need todraw()
two things, which is not that much! But if that's too much, here how you can iterate over a dictionary:The text was updated successfully, but these errors were encountered: