Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Help! Please with swift Sprite Kit Game

My minX is a offscreen point I don't know why this is happening but I'm really interested in getting this right so please help It is just affected in the x axis & it is different in every simulator... PLEASE HELP!! There is approximately 265 pixels from MIN X to the screen i see in the simulator The code:

override func didMoveToView(view: SKView) {
    addEnemyTimeInterval = 1.7

    self.backgroundColor = UIColor.purpleColor()

    let slidingBarController = slidingBar()
    let slidingBarGame = slidingBarController.createSlidingBarAtPostion(position: CGPointMake(CGRectGetMinX(frame)+300, CGRectGetMinY(frame)), size: CGSizeMake(CGRectGetMaxX(frame), 50))
    self.addChild(slidingBarGame)

    println(slidingBarGame.frame.size) // this printed "1024.0, 50"

    let mainCharacterController = circle()
    let character: (SKNode) = mainCharacterController.createCircleAtPosition(position: CGPointMake(CGRectGetMidX(self.frame), CGRectGetMinY(self.frame)+100))
    self.addChild(character)


    /*let testSquare = SKSpriteNode (color: UIColor.blackColor(), size: CGSizeMake(200, 200))
    testSquare.position = CGPointMake(CGRectGetMinX(frame)+296, CGRectGetMinY(frame)+70)
    testSquare.anchorPoint = CGPointMake(-0.0, -0.0)
    testSquare.name = "TestSquare"

    println(testSquare.position)                   Square that helped figure out "start screen point (MIN X)"

    self.addChild(testSquare)
    */

    physicsWorld.contactDelegate = self
    physicsWorld.gravity = CGVectorMake(0.0, -0.3)
}

Now after searching and exploring I'm pretty sure it has to do with the .sks file and its size, please help me get trough this

Kai Schuerrer
Kai Schuerrer
11,208 Points

You should add some code...