Grab the repo first! There is starter project/code in there.
https://classroom.github.com/a/Xy8dNQNj
Get the orange circle bouncing off one wall.
Bounce.cs
script on the circle to make it move at constant velocity (just like in lab01, but without user control)
Start
, set the _velocity
vector to some hardcoded random directionCamera.main.ViewportToWorldPoint
, and note that the viewport goes from 0,0 to 1,1GetComponent
and SpriteRenderer.sprite.bounds.extents
to determine sprite sizeUpdate
Complete the collision detection and response for all four walls.
Random.Range
method_velocity
to that random direction vector multiplied by SPEED
Add two more circles to the scene and use the same script on all three. You shouldn't have to make any changes to the script to have it work on the three separate circles which should each start off in their own random direction.
Too predictable. Make the three circles appear at different times.
Bounce.cs
script on each circle so they don't start updatingSpawner.cs
script to the CirclePool