Hi Slasher.
After looking at the Script you showed, it got me thinking.
Messing around with your script I finally ended up with this...
Code: ags
Now when a Ghost or other such nasty beastie collides with character he stops and screams, Only once, the meter goes down and then you continue along your merry way.
This may not be the prettiest way or even the correct way but it seems to work, to a fashion.
If anyone knows of a better way then please enlighten me.
Thank you Slasher for giving me the Idea, much appreciated.
Yours.
Jay.
After looking at the Script you showed, it got me thinking.
Messing around with your script I finally ended up with this...
function room_RepExec() {
// SCARE SCRIPT.
//---------------------------------------------------
// If the GHOSTS or other CREATURES collide with EGO,
// they SCARE him.
if (AreThingsOverlapping(ZOMB, DAN)) {
UpdateHeartGUI(-40);
aScream.Play();
cDan.StopMoving();
Wait(40);
aScream.Stop();
if (UpdateHeartGUI(-0) == 0){
QuitGame(0); // More stuff happens before Quit
}
}
if (AreThingsOverlapping(ZOMB2, DAN)) {
UpdateHeartGUI(-40);
aScream.Play();
cDan.StopMoving();
Wait(40);
aScream.Stop();
if (UpdateHeartGUI(-0) == 0){
QuitGame(0); // More stuff happens before Quit
}
}
if (AreThingsOverlapping(ZOMB3, DAN)) {
UpdateHeartGUI(-40);
aScream.Play();
cDan.StopMoving();
Wait(40);
aScream.Stop();
if (UpdateHeartGUI(-0) == 0){
QuitGame(0); // More stuff happens before Quit
}
}
if (AreThingsOverlapping(GHOST, DAN)) {
UpdateHeartGUI(-20);
aGhostly.Play();
cDan.StopMoving();
Wait(40);
aScream.Stop();
if (UpdateHeartGUI(-0) == 0){
QuitGame(0); // More stuff happens before Quit
}
}
if (AreThingsOverlapping(GHOST2, DAN)) {
UpdateHeartGUI(-20);
aGhostly.Play();
cDan.StopMoving();
Wait(40);
aScream.Stop();
if (UpdateHeartGUI(-0) == 0){
QuitGame(0); // More stuff happens before Quit
}
}
}
// END OF SCARE SCRIPT.
//---------------------
function repeatedly_execute_always() {
// This section makes GHOSTS and other CREATURES move.
//----------------------------------------------------
if (!cZomb.Moving) {
if (cZomb.x < 100) {
// If the Ghost is on the left hand side of the screen,
// start it moving towards the right.
cZomb.Walk(600, cZomb.y, eNoBlock, eAnywhere);
}
else {
// Otherwise, move it towards the left
cZomb.Walk(34, cZomb.y, eNoBlock, eAnywhere);
}
}
if (!cZomb2.Moving) {
if (cZomb2.x < 100) {
// If the Ghost is on the left hand side of the screen,
// start it moving towards the right.
cZomb2.Walk(605, cZomb2.y, eNoBlock, eAnywhere);
}
else {
// Otherwise, move it towards the left.
cZomb2.Walk(34, cZomb2.y, eNoBlock, eAnywhere);
}
}
if (!cZomb3.Moving) {
if (cZomb3.x < 100) {
// If the Ghost is on the left hand side of the screen,
// start it moving towards the right.
cZomb3.Walk(600, cZomb3.y, eNoBlock, eAnywhere);
}
else {
// Otherwise, move it towards the left.
cZomb3.Walk(34, cZomb3.y, eNoBlock, eAnywhere);
}
}
if (!cGhost.Moving) {
if (cGhost.x < 100) {
// If the Ghost is on the left hand side of the screen,
// start it moving towards the right.
cGhost.Walk(582, cGhost.y, eNoBlock, eAnywhere);
}
else {
// Otherwise, move it towards the left
cGhost.Walk(34, cGhost.y, eNoBlock, eAnywhere);
}
}
if (!cGhost2.Moving) {
if (cGhost2.x < 100) {
// If the Ghost is on the left hand side of the screen,
// start it moving towards the right.
cGhost2.Walk(600, cGhost2.y, eNoBlock, eAnywhere);
}
else {
// Otherwise, move it towards the left.
cGhost2.Walk(34, cGhost2.y, eNoBlock, eAnywhere);
}
}
}
// END OF GHOST AND CREATURE MOVEMENTS SCRIPT.
//--------------------------------------------
Now when a Ghost or other such nasty beastie collides with character he stops and screams, Only once, the meter goes down and then you continue along your merry way.
This may not be the prettiest way or even the correct way but it seems to work, to a fashion.
If anyone knows of a better way then please enlighten me.

Thank you Slasher for giving me the Idea, much appreciated.
Yours.
Jay.