-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStars.swift
64 lines (55 loc) · 1.87 KB
/
Stars.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import SwiftUI
import SpriteKit
extension AnyTransition{
static var moveAndFade: AnyTransition{
.asymmetric(
insertion: .move(edge: .trailing).combined(with: .opacity),
removal: .scale.combined(with: .opacity)
)
}
}
struct Stars: View{
@State private var animationAmount: Double = 0.0
@State var StartPressed: Bool = false
@State var GameStarted: Bool = false
@State var index = 0
var gameScene: SKScene {
let scene = Menu($StartPressed)
scene.size = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
return scene
}
var body: some View {
ZStack{
if (GameStarted == false){
SpriteView(scene: gameScene)
if (StartPressed == true){
withAnimation {
Color.black
.animation(.easeIn)
}
MonitorView(GameStarted: $GameStarted,index: $index)
VStack{
Spacer()
HStack{
Spacer()
if(!(index == 2 || index == 3)){
AstronautView()
//.padding(.trailing,220)
.frame(width: 400,height: 400)
}
}
}
}
}
else {
GameView()
.onAppear{
StartPressed = false
}
}
}
.ignoresSafeArea()
.preferredColorScheme(.dark)
//.forceor
}
}