add asset SkyBackground and Components
This commit is contained in:
parent
473bf86c92
commit
d8d80b8eb7
@ -33,6 +33,8 @@
|
|||||||
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC86B9E245C88A300796EF3 /* Modal.swift */; };
|
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC86B9E245C88A300796EF3 /* Modal.swift */; };
|
||||||
9EC86BA6245C8AD000796EF3 /* ModalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC86BA5245C8AD000796EF3 /* ModalType.swift */; };
|
9EC86BA6245C8AD000796EF3 /* ModalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC86BA5245C8AD000796EF3 /* ModalType.swift */; };
|
||||||
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
|
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
|
||||||
|
C0BB0378245CCF4D00EEAC81 /* BackgroundNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0BB0377245CCF4D00EEAC81 /* BackgroundNode.swift */; };
|
||||||
|
C0BB037A245CCF6300EEAC81 /* BackgroundComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0BB0379245CCF6300EEAC81 /* BackgroundComponent.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -86,6 +88,8 @@
|
|||||||
9EC86BA5245C8AD000796EF3 /* ModalType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalType.swift; sourceTree = "<group>"; };
|
9EC86BA5245C8AD000796EF3 /* ModalType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalType.swift; sourceTree = "<group>"; };
|
||||||
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GoldWars.entitlements; sourceTree = "<group>"; };
|
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GoldWars.entitlements; sourceTree = "<group>"; };
|
||||||
ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = "<group>"; };
|
ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = "<group>"; };
|
||||||
|
C0BB0377245CCF4D00EEAC81 /* BackgroundNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundNode.swift; sourceTree = "<group>"; };
|
||||||
|
C0BB0379245CCF6300EEAC81 /* BackgroundComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundComponent.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -181,6 +185,8 @@
|
|||||||
9E78ACBD245CC9C000526FF7 /* AtkBoostSkillComponent.swift */,
|
9E78ACBD245CC9C000526FF7 /* AtkBoostSkillComponent.swift */,
|
||||||
9E78ACC3245CCA3600526FF7 /* SpySkillComponent.swift */,
|
9E78ACC3245CCA3600526FF7 /* SpySkillComponent.swift */,
|
||||||
9E78ACC1245CC9EE00526FF7 /* DefBoostSkillComponent.swift */,
|
9E78ACC1245CC9EE00526FF7 /* DefBoostSkillComponent.swift */,
|
||||||
|
C0BB0377245CCF4D00EEAC81 /* BackgroundNode.swift */,
|
||||||
|
C0BB0379245CCF6300EEAC81 /* BackgroundComponent.swift */,
|
||||||
);
|
);
|
||||||
path = Components;
|
path = Components;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -375,7 +381,9 @@
|
|||||||
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
||||||
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */,
|
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */,
|
||||||
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */,
|
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */,
|
||||||
|
C0BB0378245CCF4D00EEAC81 /* BackgroundNode.swift in Sources */,
|
||||||
11738A3B24508F68004426F1 /* Unit.swift in Sources */,
|
11738A3B24508F68004426F1 /* Unit.swift in Sources */,
|
||||||
|
C0BB037A245CCF6300EEAC81 /* BackgroundComponent.swift in Sources */,
|
||||||
11036113244B3E30008610AF /* MenuScene.swift in Sources */,
|
11036113244B3E30008610AF /* MenuScene.swift in Sources */,
|
||||||
9EA3ABE9245C6DAA006BC61D /* DefaultBaseComponent.swift in Sources */,
|
9EA3ABE9245C6DAA006BC61D /* DefaultBaseComponent.swift in Sources */,
|
||||||
9EA3ABED245C8143006BC61D /* ModalBackgroundComponent.swift in Sources */,
|
9EA3ABED245C8143006BC61D /* ModalBackgroundComponent.swift in Sources */,
|
||||||
|
21
GoldWars/GoldWars/Assets.xcassets/SkyBackground.imageset/Contents.json
vendored
Normal file
21
GoldWars/GoldWars/Assets.xcassets/SkyBackground.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "SkyBackground.jpg",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/SkyBackground.imageset/SkyBackground.jpg
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/SkyBackground.imageset/SkyBackground.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
29
GoldWars/GoldWars/Components/BackgroundComponent.swift
Normal file
29
GoldWars/GoldWars/Components/BackgroundComponent.swift
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
//
|
||||||
|
// BackgroundComponent.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Tim Herbst on 01.05.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import GameplayKit
|
||||||
|
import SpriteKit
|
||||||
|
|
||||||
|
class BackgroundComponent: GKComponent {
|
||||||
|
var sky: BackgroundNode
|
||||||
|
|
||||||
|
init(size: CGSize, anchorPoint: CGPoint) {
|
||||||
|
super.init()
|
||||||
|
self.sky = BackgroundNode(imageNamed: "cloud")
|
||||||
|
self.sky.name = "clouds"
|
||||||
|
self.sky.size = CGSize(width: size.width, height: size.height)
|
||||||
|
self.sky.position = CGPoint(x: CGFloat(i) * sky.size.width , y: anchorPoint.y / 2)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
28
GoldWars/GoldWars/Components/BackgroundNode.swift
Normal file
28
GoldWars/GoldWars/Components/BackgroundNode.swift
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// BackgroundNode.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Tim Herbst on 01.05.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import SpriteKit
|
||||||
|
|
||||||
|
class BackgroundNode: SKSpriteNode {
|
||||||
|
|
||||||
|
func update(_ currentTime: TimeInterval) {
|
||||||
|
scrollBackground()
|
||||||
|
}
|
||||||
|
|
||||||
|
func scrollBackground(){
|
||||||
|
self.enumerateChildNodes(withName: "clouds", using: ({
|
||||||
|
(node, error) in
|
||||||
|
node.position.x -= 2
|
||||||
|
print("node position x = \(node.position.x)")
|
||||||
|
if node.position.x < -(self.scene?.size.width)! {
|
||||||
|
node.position.x += (self.scene?.size.width)! * 3
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user