swift - Integer value not updating -


i creating game , trying keep record of enemy's killed sklabel node not updating. here's how i'm implementing

class gamescene: skscene, skphysicscontactdelegate {  var enemy1killcounter:int  = 0 var enemy1killcounterlabel = sklabelnode ()   override func didmovetoview(view: skview) {       createenemykilledlabel() }      func createenemykilledlabel() {      enemy1killcounterlabel.text = "\(enemy1killcounter)"     enemy1killcounterlabel.fontsize = 65     enemy1killcounterlabel.fontcolor = skcolor .blackcolor()     enemy1killcounterlabel.position = cgpointmake(400, 400)      self.addchild(enemy1killcounterlabel) }   func updateenemy1killcounter() {      enemy1killcounter = enemy1killcounter + 1      print(enemy1killcounter)  } // use next method because call method in enemy class        when enemy "killed"    func enemy1dieg () {     updateenemy1killcounter() } 

does know why label not being updated?

when update enemy1killcounter, need update enemy1killcounterlabel.text new value. besides, don't see createenemykilledlabel() called. make sure called somewhere.

a side note - variable names typically start lowercase, enemy1killcounterlabel. following standards makes code easier read others...


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo