ios - Swift: Override can only be specified on class members -



ios - Swift: Override can only be specified on class members -

in gamescene.swift file, there errors causing build fail.

override func touchesbegan(touches: nsset, withevent event: uievent) { /* called when touch begins */ touch: anyobject in touches { allow location = touch.locationinnode(self) allow sprite = skspritenode(imagenamed:"spaceship") sprite.xscale = 0.5 sprite.yscale = 0.5 sprite.position = location allow action = skaction.rotatebyangle(cgfloat(m_pi), duration:1) sprite.runaction(skaction.repeatactionforever(action)) self.addchild(sprite) } } override func update(currenttime: cftimeinterval) { /* called before each frame rendered */ }

i told 'override can specified on class members'.

how should prepare this?

this whole thing:

// // gamescene.swift // swipe racer // // created william clark on 25/10/2014. // copyright (c) 2014 arc of clark. rights reserved. // import spritekit import darwin class gamescene: skscene { override func didmovetoview(view: skview) { /* setup scene here */ var swipes = spswipes() if swipes.no_of_swipes == 5 { var array = array<uint32>(count: 5, repeatedvalue: 0) in 0 ..< 5 { array[i] = arc4random_uniform(100)} } if swipes.no_of_swipes == 10 { var array = array<uint32>(count: 10, repeatedvalue: 0) in 0 ..< 10 { array[i] = arc4random_uniform(100)} } if swipes.no_of_swipes == 25 { var array = array<uint32>(count: 25, repeatedvalue: 0) in 0 ..< 25 { array[i] = arc4random_uniform(100)} } func touchesbegan(touches: nsset, withevent event: uievent) { /* called when touch begins */ touch: anyobject in touches { allow location = touch.locationinnode(self) allow sprite = skspritenode(imagenamed:"spaceship") sprite.xscale = 0.5 sprite.yscale = 0.5 sprite.position = location allow action = skaction.rotatebyangle(cgfloat(m_pi), duration:1) sprite.runaction(skaction.repeatactionforever(action)) self.addchild(sprite) } } func update(currenttime: cftimeinterval) { /* called before each frame rendered */ } }

there syntax error @ bottom mentioned in comment section.

add "}" before line

func touchesbegan(touches: nsset, withevent event: uievent) {

ios xcode swift override runtime-error

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -