Student Game Function Creation vs Sprites

Link to the project or level: (remix of the student’s code)

What I expect to happen:
The student wants the monke sprite to be able to interact with the function that contains sprite. The student wants certain things to happen when they touch. (The student wants to use a tile set because they say it is easier to change things and they want to change it in multiple different ways.)
What actually happens:
One is a sprite the other is a function and herein lies the problem with getting what the student wants to interact
What I’ve tried: [
We tried moving the creation of the sprite to outside the function at the top, but that will only provide a small pieces as the tile portion has not been applied. I suggested making it into a sprite but the student has a vision of having things interact in multiple ways using the tile function.

Hi @rachel.krone,

I love the character! The student is off to a good start. I do think loops were a good choice to create the tiles. When I took out the sprite.pause(), I did see some tiles appear but they didn’t stay on the screen.

So, since I am not exactly sure what the goal is, I am going to share the example mini-lesson I use to teach for loops and arrays. The code first places the aliens (for your student - it would be the tiles) using a for loop outside the draw loop (similar to your students function call on line 15). Then, for loops are used to continually check to see if a collision is occurring with the alien and the ball (your student could use this to test collision with tiles and character). Take a look closely at the name of the aliens - there are 3 groups or array sets.

Your student could also look at groups. The documentation for groups is pretty clear. That would probably also work for the tiles.

Hope this helps!

1 Like