ios - 'Use of unresolved identifier' -


in code:

func didbegincontact(contact: skphysicscontact) {      var firstbody:skphysicsbody     var secondbody:skphysicsbody      if (contact.bodya.categorybitmask < contact.bodyb.categorybitmask){     firstbody = contact.bodya     secondbody = contact.bodyb     }else{         firstbody = contact.bodyb         secondbody = contact.bodya     }      if ((firstbody.categorybitmask & phototorpedocategory) != 0 && (secondbody.categorybitmask & aliencategory) != 0){         torpedodidcollidewithalien(firstbody.node as! skspritenode, alien: secondbody.node as! skspritenode)     } }  func torpedodidcollidewithalien(torpedo:skspritenode, alien:skspritenode){     print("hit")     torpedo.removefromparent()     alien.removefromparent()     aliensdestroyed++      if (aliensdestroyed > 30){         var transition:sktransition = sktransition.fliphorizontalwithduration(0.5)         var gameoverscene:skscene = gameoverscene(size: self.size, won: true)         self.view!.presentscene(gameoverscene, transition: transition)     } } 

it gives me error on:

aliensdestroyed++ //<- use of unresolved identifier 'aliensdestroyed'

if (aliensdestroyed > 30){ //<- use of unresolved identifier 'aliensdestroyed'

var gameoverscene:skscene = gameoverscene(size: self.size, won: true) //<- use of unresolved identifier 'gameoverscene'

i hope of can help. (sorry rookie questions)

you need set variable aliansdestroyed , gameoverscene before call on them. example, aliansdestroyed becoming greater thirty because xcode has no idea aliansdestroyed is.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -