landscape mode don't work properly in spritekit game

Viewed 1838

i started a platformer game in spriteKit and i have a little problem with landscape mode. When i make a jump with my hero, I use the

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

and while the hero it's in the air and collides with a wall or any object and miss his speed, then i use the

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];

CGPoint positionInScene = [touch locationInNode:self];
SKSpriteNode *touchedNode = (SKSpriteNode *)[self nodeAtPoint:positionInScene];

CGPoint posicionHero = [self.world childNodeWithName:@"hero"].position;
SKSpriteNode *touchHero = (SKSpriteNode *)[self nodeAtPoint:posicionhero];

//pragma mark -hero movement in the air

if ((touchedNode != touchHero)
    &&
    (positionInScene.x > [self.world childNodeWithName:@"hero"].position.x))
{
    [[self.world childNodeWithName:@"hero"].physicsBody applyImpulse:CGVectorMake(5, 0)];
}
if ((touchedNode != touchHero)
    &&
    (positionInScene.x < [self.world childNodeWithName:@"hero"].position.x))
{
    [[self.world childNodeWithName:@"hero"].physicsBody applyImpulse:CGVectorMake(-5, 0)];
}

}

to keep that speed. I've been testing in portrait mode and everything were ok, but my game it's in landscape mode, so finally I have blocked the game to landscape mode, and now I'm testing it in landscape mode and I'm having troubles, because when I move my finger forward in a jump, nothing happens. Instead of this I have to move my finger upward, to get that movement. I'm sure i'm missing some basic configuration for my landscape mode. Any help will be apreciated

1 Answers
Related