user3299383
user3299383

Reputation: 223

How to create a boundary in Sprite Kit

Just started making a game using sprite kit and what i need to know is how do i set up a boundary so my character stays on the screen,as in doesn't fall away due to gravity and doesn't float away when you tap the screen enough.

Upvotes: 3

Views: 2491

Answers (1)

Andrey Gordeev
Andrey Gordeev

Reputation: 32559

Define physicsBody for SKScene:

self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.frame];

Described well in Apple's documentation, Listing 8-1

Upvotes: 10

Related Questions