You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/collision_detection.adoc
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,11 @@ Collision Detection
4
4
We already introduced a `isGameOver` function, but it returns always false.
5
5
The first and only rule for __game over__ in this game is that the game is over when the player collides with any enemy.
6
6
7
-
We therefore need to write a collision detection. To keep things simple, we
7
+
We therefore need to write a collision detection. The enemies are composed out of trapezoids. In order to keep it simple we assume that the enemies are sectors of a circle, because that is much easier to work with.
8
8
9
-
We assume that the player collides with an enemy if the player's angle is inside the segment of the enemey, if enemy's inner radius is smaller than the player's radius and if the enemy's outer radius is still
9
+
image:withradius.png[alt=""]
10
+
11
+
We assume that the player collides with an enemy if the player's angle is inside the segment of the enemey, if enemy's inner radius (R1) is smaller than the player's radius (plus it's height) and if the enemy's outer radius (R2) is still
0 commit comments