Sprite Collision detection area



For U3 L22 student is creating a game similar to Flappy birds. The obstacle sprites the player must avoid are triangular icicles that hang down and protrude up. The obstacle sprites collision area can be either circular or rectangle which both creates too much space “before” the player actually comes into contact with the triangular shaped sprite , so when player sprite is “too far” away from the obstacle, the player loses when they really didn’t “touch” the obstacle. Student needs the area to be smaller and closer to the true shape of the obstacle (triangle: wide at top, thinner at bottom) instead of circle or rectangle. How do we get that?



Could you share the link to the project?



Did you ever figure this out? I was looking at the code and it still seems a bit buggy but it seems like they have changed the obstacles to rectangles.


No, it was never figured out. She “fixed” the issue by changing the obstacles and moved on with the project. Thank you!


Yeah, students in my classes often run into obstacles in trying to make what they want too. I think that this is a good lesson in the realities of programming and just life in general. How much time and effort are you going to put in to get the desired result… The really motivated student may come up with some really creative solution where other students may tend to give up easier.

One way that I can think to do this is make the obstacles out of more than one one sprite, add them to a group, and then say, if group is touching the player’s sprite. That way you can break down the the triangle into a series of increasing sized rectangles. (I’m not sure that this makes sense.)

I’m not sure there is a lesson that deals with groups yet. You can find some documentation in the game lab by selecting group in the toolbox and then hovering over the different functions and whatnot in the toolbox.