Game Development Reference
In-Depth Information
{
tankStatsForLocal.tankPosition =
CGPointMake(self.frame.size.width/
2,self.frame.size.height * 0.95);
tankStatsForLocal.tankRotation = M_PI;
self.localTankSprite.position =
tankStatsForLocal.tankPosition;
self.localTankSprite.zRotation =
tankStatsForLocal.tankRotation;
self.remoteTankSprite.position =
CGPointMake(self.frame.size.width/
2,self.frame.size.height * 0.05);
self.remoteTankSprite.zRotation = 0.0;
}
else if (self.localTankSprite ==
self.redTankSprite && self.remoteTankSprite ==
self.blueTankSprite)
{
tankStatsForLocal.tankPosition =
CGPointMake(self.frame.size.width/
2,self.frame.size.height * 0.05);
tankStatsForLocal.tankRotation = 0.0;
self.localTankSprite.position =
tankStatsForLocal.tankPosition;
self.localTankSprite.zRotation =
tankStatsForLocal.tankRotation;
self.remoteTankSprite.position =
CGPointMake(self.frame.size.width/
2,self.frame.size.height * 0.95);
self.remoteTankSprite.zRotation = M_PI;
}
}
10. In this method, the local data structure
tankStatsForLocal
and the local
player's attributes position,
zRotation
using the only
tankStatsForLocal
are set to the initial state of the game. The remote player's position and
zRota-