# Scratch - sprite 反彈(bounce)的寫法 ###### tags: `bounce` `scratch` ### 首先要理解Direction的機制。 順或逆時針均能表示角度。  順時針由0°開始0°->90°->180°->270°就是表示北、東、南及西;  逆時針由0°開始0°->-90°->-180°->-270°就是表示北、西、南及東; 即是順時針或是逆時針也可表達相同的方向,只是角度不同已而。 | 角度 | 方向 | | -------- | -------- | | -360, 0, 360 | 北 | |-270, 90|東| |-180, 180|南| |-90, 270|西| 所以若要球反彈,就只是轉換正負值就可以。 若球從135°撞牆,便要反彈到-135°    從而推斷出公式是 ### 將原來的度數 x -1 Scratch的程式就是這樣寫﹕  可參看實際[例子](https://scratch.mit.edu/projects/633781293/)。  [參考](https://en.scratch-wiki.info/wiki/Direction_(value))
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up