Swift game error message -


i following ios game tutorial. cannot figure out wrong here. error on these 2 lines.

  let newangle = percent * 180 - 180   cannon.zrotation = cgfloat(newangle) * cgfloat(m_pi); 180.0    //error "use of unresolved identifier 'percent'" 

the tutorial uses:

  cannon.zrotation = cgfloat(newangle) * cgfloat(m_pi)/ 180.0 

but changed error suggested


import spritekit  class gamescene: skscene {     var cannon: skspritenode!     var touchlocation:cgpoint = cgpointzero       override func didmovetoview(view: skview) {         /* setup scene here */          cannon = self.childnodewithname("cannon") as! skspritenode      }       override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) {        /* called when touch begins */         touchlocation = touches.first!.locationinnode(self)     }      override func touchesmoved(touches: set<uitouch>, withevent event: uievent?) {         touchlocation = touches.first!.locationinnode(self)      }      override func update(currenttime: cftimeinterval) {         /* called before each frame rendered */          let precent = touchlocation.x / size.width          let newangle = percent * 180 - 180          cannon.zrotation = cgfloat(newangle) *; cgfloat(m_pi); 180.0     } } 

you declare constant let precent attempt use percent. check spelling carefully.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -