The O.G. Virtual learning! Buy one, get 2 more Lifetime Memberships! - Click Here!

Ken Walker

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in:
  • May 10, 2016 at 9:46 am #149634

    Finally got this working.

    I created a function in GameScene_Operations.swift as below and called it when the ball collides with my custom “light”. Works just like I want. I’m using ½ second delay.

        func turnOffOneWayBumpersFor(time:NSTimeInterval){
            self.enumerateChildNodesWithName("//*") {
                node, stop in
                if ( == "Bumper") {
                    if let someField:SKSpriteNode = node as? SKSpriteNode {
                        let oldCategoryBitMask = someField.physicsBody?.categoryBitMask
                        someField.physicsBody?.categoryBitMask = 0
                        let oldContactBitMask = someField.physicsBody?.contactTestBitMask
                        someField.physicsBody?.contactTestBitMask = 0
                        let wait:SKAction = SKAction.waitForDuration(time)
                        let run:SKAction = SKAction.runBlock{
                            someField.physicsBody?.categoryBitMask = oldCategoryBitMask!
                            someField.physicsBody?.contactTestBitMask = oldContactBitMask!
                        self.runAction(SKAction.sequence([wait, run ]))
  • May 5, 2016 at 3:38 pm #149119

    I’m still trying to get the one way street thing going. Referring to the diagram link above.

    The green rectangle is set up as “Light”

    The red circle is set up as a “TableObject” bumper, but it’s parent node is set to the Light node above.

    If approaching from the top of the diagram, I’m trying to have contact with the Light object, disable the TableObject.

    I’m able to get at this specific Light object using a naming pattern. When a collision with that Light object is detected I used sequence to set the “collidesWithMainBall” property to false, then call the disallowBallCollison method on the child object, wait for a couple of seconds, then set the “collidesWithMainBall” to true and call allowBallCollision on the child object.

    To me this seems like it should “disable” the bumper long enough for the ball to pass over it’s space and continue going.

    Obviously if approaching the street fro the bottom of the diagram it will collide with the bumper in a normal fashion.

    Am I missing something obvious?



  • April 13, 2016 at 1:38 pm #146821

    Never mind. I’m going the way of the properties.

  • April 13, 2016 at 12:12 pm #146802

    Got it finished and working, but can go two different ways.

    I can add properties to the table for the max and min camera location and deal with it in that fashion


    I can calculate the values based upon the dimensions of the floor and the dimensions of the scene

    I’m guessing the property value approach is more in keeping with the tone of the kit, but I would need to add two property values per device type.

    What do you think?

  • April 12, 2016 at 12:54 pm #146630

    Thanks,sounds great. almost working now. I’ll email you the proposed code when I’m done. Might be a few days, got some honey-do’s coming up

  • April 11, 2016 at 8:50 pm #146471

    Yes, both horizontally and vertically. I found the ‘cameraLowestPoint and cameraHighestPoint variables and those seem to do the trick for the vertical. I have added cameraLeftMostPoint and cameraRightMostPoint and am adding a check for those in doCameraTracking(theBall:Ball). And looks like I’ll need a moveCameraLeft and moveCameraRight.

    If this seems like the right path I’m fine with that, just wanted to know if there was something already built in.

Viewing 6 posts - 1 through 6 (of 6 total)

Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!

Uh oh, missing your affiliate ID. Create one real quick