Help with a game/making things spiral

Project: https://studio.code.org/projects/gamelab/R_HRiookGkn7PkC-nl3ke6hlYiH3kLknfVSsmXRb260

Yes, one of my students from last semester coded me a valentine. And then is making me debug it :smiley:
What he is trying to do is get his buzzbot to spiral. Starting in the center and spiraling out, then spiraling back in. We ended up settling on a different method, the one you see, so I’m not sure if I’d call it “expected.” We tried having the rotation value to change at the same rate and the x and y, but it was…a bit erratic.
Any suggestions on how to make a sprite spiral?

This is a tough one. I would be inclined to suggest my own students to look into the old Frozen Hour of Code activities to see about the angles and the repetition needed to make a sprite spiral. Just a thought. What other ideas are out there?

@mjuell01,

Not sure this is exactly what you are looking for but you might try sprite.rotateToDirection? If you add:
flyBot.rotateToDirection=true;
flyBot.rotation=flyBot.rotation+5
You should see the flyBot walk in a circle (if you take away the other movement). To make that circle spiral in and out, you probably need to experiment with a while loop that would change the number you use to increase/decrease the rotation each time through the loop. Just an idea :blush:.
Michelle

3 Likes

Thanks for the suggestions all! We’ll play around with this tomorrow.