ScratchData LogoScratchData
Back to Scratch-Minion's profile

Rebound Directions Code

SCScratch-Minion•Created December 28, 2016
Rebound Directions Code
21
13
2192 views
View on Scratch

Instructions

This project provides simple code to calculate rebound angles for a ball which hits vertical and horizontal edges in Scratch. The code can be used in games similar to Pong, Brick games and sports games. Run the project many times for different random start directions. * If you want to rebound off surfaces that are inclined at other angles, see this excellent project by @deck26

Description

Code by me. Rebound directions calculated by me with pen and paper: If the ball hits a vertical wall (left or right wall) then Rebound Direction = Approach Direction * -1 If the ball hits a horizontal wall (top or bottom wall) then Rebound Direction = 180 - Approach Direction

Project Details

Project ID138052902
CreatedDecember 28, 2016
Last ModifiedNovember 20, 2024
SharedMarch 27, 2017
Visibilityvisible
CommentsAllowed