Shooting and Moving
- Goal for the day
- There is one big idea here.
- If I am located at (x,y), traveling at an angle of θ and I take a step.
- x will change by stepSize*cos(θ)
- y will change by stepSize*sin(θ)
- Note what is really important here is that each object keeps track of it's own transformation information.
- This gets updated when the object is moved.
- And is used when the object is drawn.
- I added shots because I wanted to.
- How could we modify this to check for impacts avoid collisions?
- Remeber, we can querry the contex for the current transformation matrix.
- So we could compute our "center" in canvas coordinates.
- And projecting a point from the center, we could also compute our "scaled" radius.
- So we could build a vector of scene elements.
- And compute collision as before.