Skip to content

Add calculate_collision_direction usage example - #800

Open
Osaid2993 wants to merge 2 commits into
thoth-tech:mainfrom
Osaid2993:usage-example-calculate-collision-direction
Open

Add calculate_collision_direction usage example#800
Osaid2993 wants to merge 2 commits into
thoth-tech:mainfrom
Osaid2993:usage-example-calculate-collision-direction

Conversation

@Osaid2993

Copy link
Copy Markdown

Description

Splashkit Function: calculate_collision_direction

Overview of example functionality: This example demonstrates how calculate_collision_direction_between_circles calculates the direction between two overlapping circles. The user can move the blue circle using the Arrow Keys. When the circles collide, a yellow line shows the calculated collision direction and the on-screen status changes to indicate that a collision has been detected.

Example Output:
calculate_collision_direction-1-example

Files Included

  • C++ code
  • C# code (Top-Level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Relevant title for the example (.txt)
  • Screenshot

Usage Example Checks (READ CAREFULLY)

  • Code uses Splashkit function above
  • Code does not use non-Splashkit functions
  • Code does not use extra function declarations or extra classes
  • Code does not violate any of the Thoth Tech SplashKit Style Guide rules
  • Simple, clear demonstration of the function
  • Tested in Chrome and Firefox

@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 80f1084
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a71fc357083220008c1dbbe

@ralphweng2023 ralphweng2023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice example, driving the moving circle with the arrow keys makes the direction vector easy to actually see rather than just read about. The C++ and both C# versions look right to me, CalculateCollisionDirection and CircleAt are genuine overloads in those two languages so the calls resolve.

Python is the problem. It doesn't overload, every type combination gets its own name, and two calls in the .py don't exist as written. circle_at takes a point and a radius, the three argument form is circle_at_from_points. There is no bare calculate_collision_direction in the Python binding either, the circle to circle one is calculate_collision_direction_between_circles. So the .py raises before it draws anything, which also means the gif can't have come from that version. Please switch both names over.

@Osaid2993

Copy link
Copy Markdown
Author

Thanks @ralphweng2023. I updated the Python version to use circle_at_from_points and calculate_collision_direction_between_circles, and verified it runs correctly.

@ralphweng2023 ralphweng2023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the quick turnaround. 80f1084 renames all three calls, circle_at_from_points for both circles and calculate_collision_direction_between_circles for the collision check, which is the right mapping for the way the Python binding splits those overloads out. The C++ and both C# versions were already correct and are untouched by the fix. Approved.

@Nadiazahan Nadiazahan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work on this usage example. The different language versions are consistent and clearly show how calculate_collision_direction works between two circles. The arrow key movement also makes the example easy to understand and test. The Python changes look fixed now, and the GIF and description are included as required. Everything looks good to me. Approved.

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.

3 participants