xcode - Can't get Custom Class working in SpriteKit Scene (swift & xcode7 beta) -


i not sure if bug or not, when set custom class name on 1 of sprite, seems ignored.

enter image description here

i tried dragged asset, , empty node, both ignores monkey class association , create raw skspritenode.

the monkey node code follow.

import foundation import spritekit  class monkey: skspritenode{      let monkeywalkatlas = sktextureatlas(named: "monkeywalk")      override init(texture: sktexture?, color: nscolor, size: cgsize) {         super.init(texture: texture, color: color, size: size)         print("monkey.init debug")     }      required init?(coder adecoder: nscoder) {         super.init(coder: adecoder)     } } 

note: custom class on .sks node new in xcode7.

edited june 21st 2015

i simplified setup, still issue whe compiling/running in ios9 simulator. created project default spritekit template, chnage gamesence have following (and empty monkey class)

import spritekit  class gamescene: skscene {      override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) {         print("touch down")        /* called when touch begins */         node in self.children {             print(node)         }     }      override func update(currenttime: cftimeinterval) {         /* called before each frame rendered */     } }  public class monkey: skspritenode {} 

dragged empty node on gamescene.sks, set custom class monkey, when touch down print sub nodes, again:

touch down <skspritenode> name:'sknode_0' texture:['nil'] position:{753.5, 333.5} scale:{1.00, 1.00} size:{0, 0} anchor:{0, 0} rotation:0.00 

in swift have add module name before class name. can find module name in build settings in field "product module name". if use "-" in project name module name converts "-" "_".(in test project called "test-game" module name "test_game" have use "test_game.monkey" custom class works me in current xcode beta)


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -