UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Project 11 - Sprites rendering slightly lower than bottom of screen

Forums > 100 Days of Swift

I have set the GameScene anchor point to be 0, 0 but sprites with 0.5, 0.5 as an anchor point (the middle of the sprite) are rendering under the bottom of the screen. For the bouncer, I would expect half of the bouncer to be visible when rendered at a y-value of 0 but only the top 30% is visible. When the balls (sprites) fall using physics, they also disappear under the bottom edge of the screen.

Any idea what I'm doing wrong here?

3      

Are you using an actual device to test or the simulator? And, which device or simulator are you using?

I'm mostly just curious about those questions. But in some of my projects so far, I found that they would go off the bottom of the screen if I wasn't using the 13" ipad simulator. (I don't have an actual iPad to test on)

But I have found that if I change this line in the GameViewController.swift file...

scene.scaleMode = .aspectFill

To...

scene.scaleMode = .fill

it seems to fix the problem for me.

5      

Legend! That solved it for me -- thank you.

To answer your question, I am using an iPad mini (6th gen) simulator.

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.