I want change the opacity of an picute for each input number
For example,I enter value in input number as 100 then opacity of picture will change to value 100,I enter value in input number as 1 then opacity of picture will change to value 1,I enter value in input number as 45 then opacity of picture will change to value 45
How can i do it?
Sorry for my bad english
You could do this with a LOT of Conditional Branch commands, but I'd suggest a Script command instead, e.g.
var pic = $gameScreen.picture(2);
pic._targetOpacity = $gameVariables.value(3);
pic._duration = Math.max(pic._duration, 1);
I.e. set the target opacity of picture ID 2 to the value of variable ID 3, then set the picture's "move duration" to its current duration or 1 frame, whichever is longer.
Yes. Like I said, my example sets the opacity of picture ID 2 to the value of variable ID 3. You can change the numbers for your situation: picture ID 3 and the variable ID you are using for the number input.
Here's the event I used to test it:
◆Show Picture:#1, icon, Upper Left (0,0), (100%,100%), 255, Normal
◆Control Variables:#0031 Input = 255
◆Loop
◆Text:None, Window, Bottom
: :Enter new opacity value:
◆Input Number:Input, 3 digits
◆Script:var pic = $gameScreen.picture(1);
: :pic._targetOpacity = $gameVariables.value(31);
: :pic._duration = Math.max(pic._duration, 1);
◆Text:None, Window, Bottom
: :Picture 1 opacity set to \v[31].
: :Go again?
◆Show Choices:Yes, No (Window, Right, #1, #2)
:When Yes
◆
:When No
◆Break Loop
◆
:End
◆
:Repeat Above
◆Erase Picture:#1
It works for me. If you're having trouble, maybe share some screenshots of your event to show what you're doing?