Hello,
I'm coming to you because I have a problem when I try to start a timer with an integrated variable. This sends me a compilation error, I don't know how to send a variable in my timer function. I have two "swift" files and I want to keep two different files for my functions.
my error:
"Instance member 'AttaqueCanon' cannot be used on type 'ExtensionTimer'; did you mean to use a value of this type instead?"
Thank for your help !
In my "main.swift"
let ExtensionTimer = Fichier2()
gameTimerAttaqueCanon = Timer.scheduledTimer(timeInterval: 0.5, target: self, selector: #selector(ExtensionTimer.AttaqueCanon(tt:Sprite1)), userInfo: nil, repeats: true)
in my "Fichier2.swift"
import Foundation
import SpriteKit
class ExtensionTimer {
@objcfunc AttaqueCanon(tt:SKSpriteNode) {
let Canon1 = tt.childNode(withName: "Canon")
}
}