subscribe on iTunes
So the new game I want the baddies to take several patterns across the screen, one of them is a SIN wave. Ended up using Excel to remind me of Radians and work out a formula to input amplitude which I can use for y axis size.
Thumberjack math and rotation?
func isFingerTouchingLine()->Bool{....let minX = (xPos - (n.size.width / 2) ) - self.touchTolerancelet maxX = (xPos + (n.size.width / 2)) + self.touchTolerancelet minY = yPos - self.touchTolerancelet maxY = yPos + n.size.height + self.touchToleranceif n.zRotation == 0 {if self.tloc.x >= minX && self.tloc.x <= maxX && self.tloc.y >= minY && self.tloc.y <= maxY {retval = true}} else {let testpoint = self.rotate_point(realpos, angle: -n.zRotation, p: self.tloc)if testpoint.x >= minX && testpoint.x <= maxX && testpoint.y >= minY && testpoint.y <= maxY {retval = true}}....return retval}func rotate_point(_ c :CGPoint, angle :CGFloat, p: CGPoint)->CGPoint{let newx = cos(angle) * (p.x - c.x) - sin(angle) * (p.y - c.y) + c.xlet newy = sin(angle) * (p.x - c.x) + cos(angle) * (p.y - c.y) + c.ylet new = CGPoint (x: newx, y: newy)return new}ThumberJack Rotated Objects
Where did I lean to code on Apple
https://www.raywenderlich.com
Don't throw the baby out with the bathwater.
Shark Attack
Ironman Training 30 Weeks to go.
https://twitter.com/j0hnniemac
Music Licensed from : mobygratis.com - song: RotatorPodchaser is the ultimate destination for podcast data, search, and discovery. Learn More