Hello people, I have a question, I would like to develop an Applewatch game and use the crown to move the player on one axis is that possible? and if so can someone give me a sample code?
Thanks in advance for your help
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hallo I have a question. Is it possible that you can access a variable that you created in swiftui in other frameworks? In my case, for example, on the counter. Thanks in advance :)
import SwiftUI
import SpriteKit
class Gamescene: SKScene {
var player = SKSpriteNode(color: .red, size: CGSize(width: 20, height: 20))
override func sceneDidLoad() {
player.position = CGPoint(x: size.width / 2, y: size.height / 2)
addChild(player)
}
}
struct ContentView: View {
public var counter = 0.0
var body: some View {
SpriteView(scene: Gamescene(size: CGSize(width: 100, height: 150)))
.ignoresSafeArea()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}