swift - iOS 8 Game with SpriteKit for any device -
i'm creating simple game using sprite kit
in swift
. game has simple grid of spritekitnodes
, inquire what's improve way develop devices in single shot.
i've learned new size classes
feature in storyboard used here in spritekit
? how implement constraint via code?
here i'm creating nodes in determined positions of course of study needs manipulated depending of size of device.
func addnodetoscene(x: cgpoint,y: cgpoint) { allow node = skspritenode(color: self.colorofspritenode, size: cgsize(width: 50, height: 50)) node = string(format: "node%d", self.nodeidentifier) ++self.nodeidentifier node.position = cgpoint(x: x, y: y) addchild(node) }
i've checked class skcontraint, used purpose?
here how determine if on ipad (this code objective c should real easy convert swift)
if ( ui_user_interface_idiom() == uiuserinterfaceidiompad ) { homecoming yes; /* device ipad */ }
and here post incase want determine more specific iphone sizes: detecting iphone 6/6+ screen sizes in point values
-hi rawr
ios swift sprite-kit size-classes
No comments:
Post a Comment