ItsLolgical
ItsLolgical

Reputation: 632

How to update an SKScene programmatically?

So, I have a SKScene in swift that I want to completely erase, as in remove all sprites so I can redraw it from scratch. Is there a built in method for this?

Upvotes: 1

Views: 273

Answers (2)

Dominique Vial
Dominique Vial

Reputation: 3949

If you want to restart from scratch, you can use Initialization to achieve this as stated by the Swift Documentation:

Initialization is the process of preparing an instance of a class, structure, or enumeration for use.

myScene = MySceneClass(someSize)

Or, if you don't need to restart from start, create a reset method that reset only what you want to reset.

At last, if your need is to remove all the sprites then use removeAllChildren().

Upvotes: 1

MaxKargin
MaxKargin

Reputation: 1545

Yes, what you are looking for is:

removeAllChildren()

Upvotes: 2

Related Questions