Hey there. I'd like to propose a few suggestions for AGS:
GetObjectTransparecy and GetCharacterTransparecy - You'd need those to make a cycle like an object or a character gradually appearing/disappearing etc
DisplaySpeechBackgroundAt and DisplayQueuedSpeechBackgroundAt - pretty self-explanitory, useful if you have a subtitle line at the bottom.
I hope that these are coherent.
Quote from: Vel on Sun 12/09/2004 21:43:13
GetObjectTransparecy and GetCharacterTransparecy - You'd need those to make a cycle like an object or a character gradually appearing/disappearing etc
Well, strictly speaking you don't
need these. You can just keep track of the current transparency in a variable. If you wanted to cycle the transparency you'd need to have a variable saying whether it was fading out or in anyway. And if you wanted to fade out or in at any speed other than a multiple of the game speed you'd need a variable storing the current transparency in a higher precision.
P.S. I know English isn't your first language, so I thought you might appreciate someone pointing out that transparency has two 'n's and explanatory has two 'a's.
Quote from: Vel on Sun 12/09/2004 21:43:13
DisplaySpeechBackgroundAt and DisplayQueuedSpeechBackgroundAt - pretty self-explanitory, useful if you have a subtitle line at the bottom.
-Just- suggested DisplaySpeechBackgroundAt myself ^_^
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=16645.0
Quote from: Vel on Sun 12/09/2004 21:43:13
GetObjectTransparecy and GetCharacterTransparecy - You'd need those to make a cycle like an object or a character gradually appearing/disappearing etc
Would anyone else find these useful?
Yes this would be a great addition. I think space games or games with ghosts might benefit from it greatly.
But what's the problem keeping track of them with variables? If you use such functions you're text-scripting already.
I for one do not find those functions useful, CJ. You can do it quite eaily without them. I just use "a" as a variable and a "while" statement to keep track of it.
//Fade a character out gradually
int a=0;
while (a<100) {
SetCharacterTransparency(EGO, a);
a++;
Wait(1);
}
That's it. Who needs the Get... variables?
Well, supposing you can't be sure you're starting with 100 or 0 transparency, you won't know what value a should start at.
Since you almost always have control over the actual setting of the transparency, this may seem unimportant, but suppose you wanted to create the following functions: ReduceCharacterTransparency(int charID, int by_amount, int rate, int pause) and IncreaseCharacterTransparency, you would have to do something like this:
function ReduceCharacterTransparency(int charID, int by_amount, int rate, int pause) {
SetCharacterTransparency(charID, GetCharacterTransparency(charID) - by_amount); // for an instant transition
// OR
int init_trans = GetCharacterTransparency(charID);
while (GetCharacterTransparency(charID) > init_trans - by_amount) {
SetCharacterTransparency(charID, GetCharacterTransparency(charID) - rate);
Wait(pause);
}
I left out the part where I needed to check wether it went too low, if by_amount is 10 for example, and rate is 7. But that's me being lazy right now ;).
Situations in which you don't know what the initial transparency is could be when you randomly changed it or when it keeps changing in repeatedly execute as and animation (f.e. a ghost is floating while changing transparency, until you spray something on it (root beer? :D), when it loses 10 transparency each time).
So, yeah, if it's easy to implement, these functions would be a nice addition. :)
Yeah, Get* is quite useful if we don't know a start value, as Ginny says or if that value is initially set via the AGS editor - in that case we'd like to refer to it. Transparencies aren't set in the editor but it would still be handy to get the value for writing some functionsÃ, as Ginny demonstrated. Currently, we'd need to have an additional array to store transparency values but since the engine keeps track of them anyway it would be handy to get that info. :)
But isn't that easy, still? Example:
int chartrans[30];
...
function ReduceCharacterTransparency(int charID, int by_amount, int rate, int pause) {
chartrans[charID]-=by_amount;
if (chartrans[charID]<0) chartrans[charID]=0;
SetCharacterTransparency(charID, chartrans[charID]);
}
(I originally wanted to use GetGameParameter() for the character coutn in the array declaration, but changed my mind, as I think the compiler probably only accept fixed values at compiled time.)
Quote(I originally wanted to use GetGameParameter() for the character coutn in the array declaration, but changed my mind, as I think the compiler probably only accept fixed values at compiled time.)
True. I was hoping to use it for arrays as well. :-\
I think it makes sense to have the Get/Set functionality.
Gilbot's code, while simple, is not as obvious as Ginny's...
Ok then, I've seen enough people in favour, I'll add it to my list.