swift3 - How to increase gravity using an if statement -
i have set gravity @ start of game objects fall quite slow , player collects these items want gravity increase.
override func didmove(to view: skview) { self.physicsworld.gravity = cgvector(dx: 0.0, dy: -3.0) initializegame() }
i have set gravity unsure on how edit if statement. e.g. if score = 20 gravity increases. great on how this
you might want through spritekit tutorial. generally, updating properties happens in update(_ currenttime: timeinterval)
method. can implement method in skscene subclass:
override func update(_ currenttime: timeinterval) { if (score == 20) { // whatever condition want // whatever want } }
Comments
Post a Comment