Group Group Group Group Group Group Group Group Group

SpriteKit: How to create a region that's the same size as the device screen?

Hello,

I’m working in SpriteKit and I need to create a ‘playable area’, an area that is same size as the device screen so that I can stop my player from moving off-screen.

I’m using the following line of code:

var playableRect: CGRect = UIScreen.main.bounds

But the resulting rectangle is about a quarter of the device screen, with a corner of that rectangle at what looks to be the center of the screen. And the device orientation doesn’t change that.

I’ve tried everything I can think of. Nothing is working.

How do I create a rectangle that’s the same size as the device screen?

Thank you

@kenkelm Do you still have issues with this?