Computer Science Canada "Dodge Ball" Game- Collision Checking Issues |
Author: | boomgreen87 [ Tue Oct 28, 2014 7:58 am ] | ||
Post subject: | "Dodge Ball" Game- Collision Checking Issues | ||
What is it you are trying to achieve? I'm taking a programming class for the first time and I've been in the class for about 2 months. I have a lot of free time in class so I am trying to create a "dodge ball" game. What is the problem you are having? I can't get the game to properly check when a ball hits the player Describe what you have tried to solve this problem Various 'if' statements. An example is in the current code. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1.1 |
Author: | Zren [ Tue Oct 28, 2014 8:31 am ] |
Post subject: | RE:"Dodge Ball" Game- Collision Checking Issues |
The skill you're trying to learn is called Collision Detection. For a beginner, you should pick between checking for collisions between circles, or between rectangles. Doing collision detection between a circle and a rectangle (properly) is intermediate level. Since you want "dodge balls" to be a circle, I'd advise turning your player into a circle as well. You can learn about Circle collision detection in the Turing Walkthrough. http://compsci.ca/v3/viewtopic.php?t=13661 Circle collision detection is basically calculating if the distance between the centers of both circles (using the Pythagorean theorem) is smaller or equal to the sum of both radius's. |
Author: | boomgreen87 [ Wed Oct 29, 2014 7:01 am ] |
Post subject: | Re: "Dodge Ball" Game- Collision Checking Issues |
Okay! Thanks a lot! |