jeudi 30 avril 2015

How do i detect if a number is a decreasing or increasing number? iOS

I'm using a SpriteKit game engine within XCode while developing a game that bounces a ball and platforms come from the sky and the objective is to bounce on the platforms to get higher. I need to add a velocity to the ball when it falls down + comes in contact with a platform. I'm having trouble trying to detect the balls Y position. I had something like this in the update method but nothing happens?... I'm open to suggestions.

//The value of the _number instance variable is the Y position of the ball.

if (_number++) {
        NSLog(@"UP");
    }


    if (_number--) {
        NSLog(@"DOWN");
    }

Aucun commentaire:

Enregistrer un commentaire