[英]Constantly changing the background color in swift
嗨,我正在完成我的游戲,但我想添加一些細節,其中一個是通過色彩循環循環,我嘗試過SKActions,效果很好,但其他方面卻重疊了。
然后我在更新功能中做到了這一點,但它什么也沒做
if BGRed == 1 {RedBoolIs1 = true}
else {RedBoolIs1 = false}
if BGGreen == 1 {GreenBoolIs1 = true}
else {GreenBoolIs1 = false}
if BGBlue == 1 {BlueBoolIs1 = true}
else {BlueBoolIs1 = false}
//red only
if RedBoolIs1 == true && GreenBoolIs1 == false && BlueBoolIs1 == false {
BGGreen = BGGreen + 0.01 }
//red and green
if RedBoolIs1 == true && GreenBoolIs1 == true && BlueBoolIs1 == false {
BGRed = BGRed - 0.01 }
//green only
if RedBoolIs1 == false && GreenBoolIs1 == true && BlueBoolIs1 == false {
BGBlue = BGBlue + 0.01 }
//green and blue
if RedBoolIs1 == false && GreenBoolIs1 == true && BlueBoolIs1 == true {
BGGreen = BGGreen - 0.01 }
//blue only
if RedBoolIs1 == false && GreenBoolIs1 == false && BlueBoolIs1 == true {
BGRed = BGRed + 0.01 }
//blue and red
if RedBoolIs1 == true && GreenBoolIs1 == false && BlueBoolIs1 == true {
BGBlue = BGBlue - 0.01 }
self.backgroundColor = SKColor(red: CGFloat(BGRed), green: CGFloat(BGGreen), blue: CGFloat(BGBlue), alpha: 1)
也可以使標簽在所有顏色上可讀嗎? 我現在的解決方案是將2個標簽相互放置,第一個標簽是白色且45個大標簽,上面的標簽是黑色且40個大標簽,但是看起來並不總是那么好
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.