What is the best way to keep the touch pad within the limits of the green box? Currently the stick is able to move all over the screen, howver I would like to limit it's movement to the green box area.
Use the clamp function to limit the position of sangStick. For example, every tick you could set the position of sangStick to:
X: clamp(sangStick.X, boundary.BBoxLeft, boundary.BBoxRight)
Y: clamp(sangStick.Y, boundary.BBoxTop, boundary.BBoxBottom)
You might be interested in this Touchstick example:
Develop games in your browser. Powerful, performant & highly capable.