Hi
I have a series of events that are set off by a Timer in Rep..
These events cause an object (bird) to fly around a scene.
I have 4 different Random options of where the bird fly's to.
This is ok and works as it should.
I have also incorporated a collide with character so should the bird touch the character during one of it's flights a series of events happen as below..
My problem at the moment is that the Display and Say happen even if the bird is not colliding with character.
I'm sure it's a script thing and possibly {}.. ::)
I will study the script again and all help appreciated..
if (IsTimerExpired(1) == 1) {
int ran=Random(2);
if (ran == 0 ) {
obird.Animate(0, 5, eRepeat, eNoBlock);
object[4].Move(460, 662, 3, eBlock, eAnywhere);
if (cwizard.IsCollidingWithObject(object[4]) == 1)
Display("The bird's claws catch you on the neck!!");
Wait(1);
cwizard.Say("Ouch!!");
object[4].Move(380, 502, 3, eBlock, eAnywhere);
SetTimer(1, 100);
barefoot
if (IsTimerExpired(1) == 1) {
int ran=Random(2);
if (ran == 0 ) {
obird.Animate(0, 5, eRepeat, eNoBlock);
object[4].Move(460, 662, 3, eBlock, eAnywhere);
if (cwizard.IsCollidingWithObject(object[4]) == 1){
Display("The bird's claws catch you on the neck!!");
Wait(1);
cwizard.Say("Ouch!!");
object[4].Move(380, 502, 3, eBlock, eAnywhere);
SetTimer(1, 100);
}
}
I hate non-bracketed stuff much as anything. So that may be it as well.
Cheers Dualnames
this seems to work ok
if (IsTimerExpired(1) == 1) {
int ran=Random(0);
if (ran == 0 ) {
obird.Animate(0, 5, eRepeat, eNoBlock);
object[4].Move(460, 662, 3, eBlock, eAnywhere);
if (cwizard.IsCollidingWithObject(object[4]) == 1){
Display("The bird's claws catch you on the neck!!");
Wait(1);
cwizard.Say("Ouch!!");
object[4].Move(380, 502, 3, eBlock, eAnywhere);
}
else if (cwizard.IsCollidingWithObject(object[4]) == 0){
object[4].Move(380, 502, 3, eBlock, eAnywhere);
}
SetTimer(1, 100);
}
}
Thank you
barefoot
Shouldn't you test for the two conditions independently?
I imagine a flying bird can hit the player at any time, not just at the end of a timer.
Mmm good idea Khris... it does make sense.. :=
cheers
barefoot