Skip to content

Bullet fix red dot#6

Open
lexlam1524 wants to merge 3 commits intothoth-tech:mainfrom
lexlam1524:bullet_fix_red_dot
Open

Bullet fix red dot#6
lexlam1524 wants to merge 3 commits intothoth-tech:mainfrom
lexlam1524:bullet_fix_red_dot

Conversation

@lexlam1524
Copy link

@lexlam1524 lexlam1524 commented Sep 21, 2024

BeeFall.2024-09-21.23-16-59.mp4

Pull Request Description

Title: Fix Bullet Circle Positioning

Overview

This pull request addresses an issue with the visual representation of bullet sprites in the game. The red debug circle intended to indicate the center of each bullet sprite was incorrectly positioned at the top-left corner of the sprite instead of its center.

Changes Made

  • Adjusted the position of the red debug circle to be centered on the bullet bitmap by:
    • Calculating the bitmap's width and height.
    • Subtracting half of these dimensions from the sprite's position when drawing the circle.

Code Snippet

Updated code for drawing the red circle:

point_2d bullet_pos = sprite_position(*it);

// Get the dimensions of the bullet bitmap
float bullet_width = bitmap_width(bullet);
float bullet_height = bitmap_height(bullet);

// Draw the red circle at the center of the bullet sprite
fill_circle(COLOR_RED, bullet_pos.x + bullet_width / 2, bullet_pos.y + bullet_height / 2, 5);

Type of change

Code

How Has This Been Tested?

Compiled and ran with
skm g++ program.cpp player.cpp obstacle.cpp bullet_factory.cpp -o game.exe

Checklist

My code follows the style guidelines of this project
I have performed a self-review of my own code
I have commented my code in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings
I have requested a review from team members on the Pull Request

Copy link

@AmberPotion AmberPotion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix merge conflicts in order for the PR to be approved.

@lexlam1524
Copy link
Author

fixed the conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants