Skip to content

The bullet will bounce when it hits an obstacle, task 1,2,4#208

Open
Xu-Yudong wants to merge 5 commits intoYao-class-cpp-studio:mainfrom
Xu-Yudong:main
Open

The bullet will bounce when it hits an obstacle, task 1,2,4#208
Xu-Yudong wants to merge 5 commits intoYao-class-cpp-studio:mainfrom
Xu-Yudong:main

Conversation

@Xu-Yudong
Copy link

No description provided.

@Xu-Yudong
Copy link
Author

Close #162
Changed cannon_ball.cpp and cannon_ball.h to realize it. "reboundn" in cannon_ball.h at line 21 is the most number of times a bullet hits an obstacle, which is the number of bounces plus one.

593fc385228f5bcc13abdf3e7160ae82.mp4

@Xu-Yudong
Copy link
Author

The previous video seems to be unable to be previewed and can only be viewed after downloading. Here it is converted to gif format.

593fc385228f5bcc13ab -original-original

@Xu-Yudong
Copy link
Author

In the process of implementing it, the movement of the bullet was changed to perform ten tenths of a frame movements at a time to match the size of the obstacle, and in theory it can be applied to obstacles of any shape, not limited to horizontal and vertical directions.

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.

1 participant