Making a day/night button issue
Thunder_Child
Member Posts: 2,343
I'm trying to make my game have a brightness setting.
I have an actor than covers the entire screen (Black)...I set another actor (sun image) to interpolate to zero when "sun" is true....if touched change attributes "sun" to false and "night to true (interpolate to .5). It starts in game in "sun" mode....I can touch and it goes to half bright but will not change back to full...in fact it flickers until I release touch.
During daytime I want it full bright...when laying in bed playing or couch I want it to not be a bright flashlight in their face.
Thanks if you think you know a quick fix to this.
Comments
Three questions:
Are you saying you want pressing the button to interpolate the alpha value of the black image to 0.5, and if you continue to hold the button without releasing it, interpolate the image alpha back to 0?
What is intended to happen if you just touch the button?
What is intended to happen if you hold the button down, but release it before 0.5 is reached?
I'm not entirely clear on how you are wanting the button to function, and understanding that is key to helping you.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline
Thanks for replying.
I want a single touch to change from "day" (interpolated to 0 by default) to change to "night" (interpolated to .5)
Then if touched again....holding not necessary....to then change back to "day"....full bright.
Day=0
Night=.5
On...off....on...off
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
I don't really understand, but I think you could have an attribute called InterpolateTo and then say
RULE: if touch is pressed
{
}
Maybe if I said it in layman's terms.
I want to touch a little icon that looks like a sun and it change to a moon and dims the screen brightness by 1/2....then if I touch the moon it changes to a sun again and makes the brightness full.
:-)
I was trying to do it with this is true and that is false. And this is false and that is true...dint work.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
@Thunder_Child Did you try this? It should work. You would interpolate self.color.Alpha to InterpolateTo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Use a Boolean for sun,
If touch is pressed and sun is true
Change sun to false
If touch is pressed and sun is false change to true
Then ,are your rules if sun is true
Interpolate alpha to 0
If false interpolate alpha to .5
www.rossmanbrosgames.com
You don't need a second Boolean for night
www.rossmanbrosgames.com
Ahhhh
Thanks @tatiang @zweg25 @RossmanBrothersGames
Yea I had a second Boolean. I like and understand the single Boolean. Makes sense. Thanks guys.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
hmmm....this does not work still...absolutely to function happens...
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
@Thunder_Child does it still flicker? I think it is just going back and forth between each rule quickly as the set of rules become true. Maybe have a display text that displays the game.DayBright to see if it is changing to true and false correctly.
You may need another boolean you can call press_ready.
In both those rules for the button, add if press_ready is true
then after it changes game.daybright have it change press_ready to false
then make another rule,
when press is released
change press_ready to true
this way it only lets you do one of the actions per press
I'm not sure actually how the pressed actions works, but that might be what is going on if it flickers between each setting
www.rossmanbrosgames.com
Will the attached demo help?
@RossmanBrothersGames
It's not flickering. I was able...after my post to get it to at least dim like I want...but not full bright again.
I can't try again until tonight...that dang day job thing :-(. Lol.
@RThurman
I will check out your demo this evening. Thank you both for your help and goin the extra distance. Even a demo.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Without trying to read through every detail in this thread and look at every example and demo, I will mention one thing you should be aware of.
GameSalad suffers from a floating point rounding error when decreasing a number from 1 to 0. I'm not sure if it's been explored on the forums before, but it's demonstrated in the project I've attached.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support