This is my code for the background chessboard. I need three different images, which is fine.
if deviceType == "iPad" {
backImagePad.anchorPoint = CGPointMake(0.5, 0.5)
backImagePad.size.height = self.size.height
backImagePad.size.width = self.size.width
backImagePad.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
self.addChild(backImagePad)
}
if (deviceType == "iPhone5" || deviceType == "iPhone6") {
backImagePhone5.anchorPoint = CGPointMake(0.5, 0.5)
backImagePhone5.size.height = self.size.height
backImagePhone5.size.width = self.size.width
backImagePhone5.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
self.addChild(backImagePhone5)
}
if (deviceType == "iPhone") {
backImagePhone.anchorPoint = CGPointMake(0.5, 0.5)
backImagePhone.size.height = self.size.height
backImagePhone.size.width = self.size.width
backImagePhone.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
self.addChild(backImagePhone)
}
However, to individually position the SKSpriteNodes (chess squares) I need to specify iPhone6 and IPhone6Plus....
I do not understand why. And it is a lot of extra work. If anyone knows a way to group the iPhone6 and 6Plus with the iPhone5 for individual positioning I would appreciate it.
H8Square.size.height = self.size.height
H8Square.size.width = self.size.width
H8Square.xScale = 0.1225
if deviceType == "iPad" {
H8Square.position = CGPointMake(720, 976)
H8Square.yScale = 0.0920
}
if deviceType == "iPhone6Plus" {
H8Square.position = CGPointMake(387.75, 710)
H8Square.yScale = 0.0680
}
if deviceType == "iPhone6" {
H8Square.position = CGPointMake(300, 548)
H8Square.yScale = 0.0680
}
if deviceType == "iPhone5" {
H8Square.position = CGPointMake(xxx, xxx)
H8Square.yScale = 0.0680
}
if deviceType == "iPhone" {
H8Square.position = CGPointMake(xxx, xxx)
H8Square.yScale = 0.0680
}
self.addChild(H8Square)