Game Development Reference
In-Depth Information
self.blueFinishLine = [SKShapeNode
shapeNodeWithRect:frame];
{
self.blueFinishLine.strokeColor = [UIColor
blueColor];
self.blueFinishLine.zPosition = 2;
[self addChild:self.blueFinishLine];
}
}
- (void)addRedFinishLine
{
CGRect frame = CGRectMake(0,
self.frame.size.height * 0.85, self.frame.size.width,
1);
self.redFinishLine = [SKShapeNode
shapeNodeWithRect:frame];
{
self.redFinishLine.strokeColor = [UIColor
redColor];
self.redFinishLine.zPosition = 1;
[self addChild:self.redFinishLine];
}
}
8. Here we use the SKNodeShape class objects, which are used to draw any re-
quired shape on the screen using the core graphics path. We are thus adding the
red and blue lines at either end of the game scene.
9. To set the tanks in the initial positions both in the data structure and in the
GameScene , we will write a method, namely, resetLocalTanksAndIn-
foToInitialState .
#pragma mark - Game Updation Methods
- (void)resetLocalTanksAndInfoToInitialState
{
if (self.localTankSprite == self.blueTankSprite
&& self.remoteTankSprite == self.redTankSprite)
Search WWH ::




Custom Search