Hi
I have just come across this, not a big major issue but an issue none-the-less though I expect its normal.
Player collides with an object. Both are on a region with tint lighting. When collision occurs a Display is displayed. The object [shark] lighting effect goes off until game play is resumed when player is Transparency=0
What I have for the event is this:
if (PPColliding.CWithO(cFrankj, oshark))
{
Game.DoOnceOnly("SHARK");
cFrankj.LockView(36);
Display("You've been eaten by the shark!");
cFrankj.UnlockView();
Lives=(Lives -1);
cFrankj.Transparency=100;
cFrankj.Move(44, 133, eBlock);
cFrankj.Transparency=0;
}
Is there a work around for this?
cheers
steptoe
I don't know about your question, but you're not using Game.DoOnceOnly right. You have to put it inside an if condition, otherwise it won't do anything. What Game.DoOnceOnly does is return true the first time, then false every subsequent time. Just calling it like that doesn't make any difference.
if (PPColliding.CWithO(cFrankj, oshark))
{
if (Game.DoOnceOnly("SHARK"))
{
cFrankj.LockView(36);
Display("You've been eaten by the shark!");
cFrankj.UnlockView();
Lives=(Lives -1);
cFrankj.Transparency=100;
cFrankj.Move(44, 133, eBlock);
cFrankj.Transparency=0;
}
}
Also, how hard can it be to indent by two spaces per level and to put a } below it's opening counterpart? ::)
Hi Khris
Sorry about that non extra space ;)
EDIT:
object[14].Baseline=0;
and I have in repeatedly_execute_always
object[14].Tint(0, 0, 250, 50, 100);
This appears to have solved the problem as per below shot.
(http://i1181.photobucket.com/albums/x423/qikfire/AGSJETPACKSHARK.png)
-----------------------------------------------------------------------------------------------------
Also, I do understand DoOnceOnly and in this case the events are run once and then the player is re positioned to try again. So, it does not run just ONCE in the game. Its used so player only loses 1 life per collision.
Actually, I don't think I even need it at all thinking about it.
The object (shark) still reverts back to non lighting when collision occurs even when i take 'Display' out.
* There is an Object (water) over the Object (shark). It is the Object Water that Is tinted.
cheers
steptoe
Quote from: steptoe on Mon 02/01/2012 12:48:16
Also, I do understand DoOnceOnly and in this case the events are run once and then the player is re positioned to try again. So, it does not run just ONCE in the game. Its used so player only loses 1 life per collision.
Sorry but apparently you don't understand it at all.
How is AGS supposed to know when you intend to reset? There's no way to do that.
Like I said, for a specific string, it'll return true the first time, then false
every subsequent time. In other words, if you run code depending on it being true, this code will only run once, then never again.
The only way to do what you want is to use a different string each time, so if you counted the collisions and turned the number into a string that would work.
However, since you are moving the player blocking out of the shark's way after a collision, the code did run only once at a time, and without the useless Game.DoOnceOnly() you put there.
--
Setting an object's baseline to 0 reestablishes default behavior, i.e. the baseline is the object's current Y coordinate.
Not sure how tinting an object 40 times per second solved this but if it did, fine.
Hi Khris
I do not use 'DoOnceOnly' now, just the events when collision happens and everything gets reset after player has moved. Don't know what I was thinking?
It's a repeat event that happens each time player collides with object after reset.
Regarding the repeatedly_execute_always Tint, well, I wanted to make sure the object (shark) was Tinted all the time.
To top matters off there is also a Timer event for drowning in the water as well as shark attack.
Whatever I have put it works game wise as wanted.
cheers
steptoe