From 199ee7a58b1833eb95a993913b1ef6e07f6042aa Mon Sep 17 00:00:00 2001 From: onpon4 Date: Wed, 11 Mar 2015 15:11:06 -0400 Subject: [PATCH] Changed horizontal location bullets are spawned. The previous method was inconsistent between the left and right directions; it placed the left edge of the bullet on the left edge of the ship when going to the right, and in the center of the ship when going left. This was barely noticeable with small ships, but more noticeable with large ships. The method also sometimes made the backs of bullets visible behind the smaller ships, which looked kind of ugly. Now, the back edge of the bullet is consistently placed in the center of the ship. --- src/bullets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bullets.cpp b/src/bullets.cpp index 59c0cf6..c11c72d 100644 --- a/src/bullets.cpp +++ b/src/bullets.cpp @@ -32,7 +32,8 @@ void addBullet(object *theWeapon, object *attacker, int y, int dy) bullet->next = NULL; bullet->active = true; - bullet->x = attacker->x - ((attacker->image[0]->w / 2) * attacker->face); + bullet->x = attacker->x + (attacker->image[0]->w / 2) - + (theWeapon->image[0]->w * attacker->face); bullet->y = attacker->y + y; bullet->flags = theWeapon->flags; bullet->shield = 300; // bullets live for (approximately) 5 seconds