hi... i am having a problam-
i want my character to go to the toilet whenever he is crossing the left room edge.
so- my plan was to make my character go outside the left border of the room, to play a "flush" sound, and then to go back to the room from the left border of the room.
the problam is that the FLUSH sound plays over and over again (doubled sound) until my computer crash. i am pretty sure it is due to the fact that it plays (over and over again) as long as i am outside the left edge. i want it to play only ONCE!
function room_LeaveLeft()
{
cEgo.Walk(-30, cEgo.y, eBlock, eAnywhere);
PlaySound(3);
cEgo.Walk(60 , cEgo.y);
}
When you make the 2nd walk command blocking, then the sound shouldn't be played..
You also might want to add a Wait(40); after the PlaySound command.
Quote
When you make the 2nd walk command blocking, then the sound shouldn't be played.
well- thats never happend, because my character never able to astablish this walk command- my AGS get stuck much before.
Quote
You also might want to add a Wait(40); after the PlaySound command.
that did not help too. why? because after the wait(40) command, my character is steel behind the edge line, so the playsound command still repeatedly executed.
my solution was to use Hotspot instead of room's edges.
i wasnt able to make it with edges though.
this is my final, working code:
function hHotspot1_WalkOn()
{
cEgo.Walk(-40, cEgo.y, eBlock, eAnywhere);
Display("after 10 minutes");
PlaySound(2);
Wait(100);
cEgo.Walk(40, cEgo.y, eBlock, eAnywhere);
}
if someone has a better solution, with edges, please notify me...
Maybe something like this will do the trick (I'm assuming the 60 is to the right of the left edge):
bool crossedLeftEdge;
function room_LeaveLeft()
{
if (!crossedLeftEdge)
{
crossedLeftEdge = true;
cEgo.Walk(-30, cEgo.y, eBlock, eAnywhere);
PlaySound(3);
cEgo.Walk(60 , cEgo.y);
crossedLeftEdge = false;
}
}