Colide for multiple sprites

I have a student who is building a pacman style game and wants to set the player to collide with maybe 30 different walls. She seems willing to use the player.collide(wall1) for all walls. I tried to pass an array into the collide function to help her out but found that I get an error of
TypeError: t.size is not a function
Has anyone been able to get a stripe to collide, displace, or bounce off of multiple sprites in one line?


Can you share a link with us? Perhaps using sprite “groups” could be a solution?


[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]
Link to the project or level: [replace with link to the curriculum or get the “Share” link to a project]
What I expect to happen: [replace with a detailed description of the behavior you’re trying to create]
What actually happens: [replace with a detailed description of what actually happens when the code runs including any errors or unexpected behavior]
What I’ve tried: [replace with a detailed description of what you’ve already tried to do to solve the problem]

Seems like sprite groups are the ticket. Thank you

1 Like