ios - Increasing an integer upon collision with an object. Swift -
i have code creates , prints score game, want score increase upon collision object. , despite best efforts, cannot seen figure out how it.
this code deals score:
import spritekit public class score { public let label = sklabelnode(fontnamed: "chalkduster") private var currentscore = 0 public func setup (fontsize: cgfloat, x: cgfloat, y: cgfloat) { label.fontsize = fontsize label.position.x = x label.position.y = y setscore(currentscore) } public func setscore(value: int) { currentscore = value label.text = string(currentscore) } public func incrementscore(value: int) { setscore(currentscore + value) } }
Comments
Post a Comment