swift - SkSpriteNode won't show up -
override func didmovetoview(view: skview) { /* setup scene here */ var sun = skspritenode(imagenamed: "sun") sun.position = cgpoint(x:cgrectgetmidx(self.frame), y:cgrectgetmidy(self.frame)) sun.xscale = 0.2 sun.yscale = 0.2 addchild(sun) }
i'm new coding games, i've worked swift, , added code , sun not show up, there isn't error, , have image name sun in images.xcassets.
you have make sure gameviewcontroller-frame fits gamescene-frame.
just add line gameviewcontroller.swift-class in viewdidload
-method before skview.presentscene(scene)
:
scene.size = skview.bounds.size
here make sure frames same , .position
works want.
Comments
Post a Comment