Hello,
I have a little problem there.
In a room the player dies by a spider..
I have a death animation which works well.
And of course I don't want the player to be able to move anymore (the corpse is lying on the ground) and there is a little animation and music that plays once the player is dead on the ground.
So i t ried these 2 commands:
cChar1.StopMoving();
cChar1.Clickable = 0;
But i am still able to move the character
what am i doing wrong ?
Thanks a lot for your help.
"Clickable" only means that you cannot click on character itself, but it does not disable any other controls.
If you want a state where controls do not work, you need to introduce some global variable (like, "IsDead"), and test it in on_mouse_click, before the place where you call ProcessClick and similar commands, to prevent these.
Same, if you have keyboard controls for player walking and interacting with the world, you will have to test this variable before doing anything.
Also, if you're playing a blocking animation, the game will block so that players can't (normally) do anything. Depending on what you want to happen after the player dies, that may be sufficient. (For example play a blocking animation for ten seconds, then jump back to the main menu or show a Restart/Reload/Quit dialog.)
One thing I have learned that I've found useful is that the player doesn't have to be the "player" the player just has to look like the player. If it's easier for you to use something else like maybe like maybe an object or even a GUI that can't move and keep the player as the player then you could do that rather than try scripting very specific behavior.
Quote from: Snarky on Tue 29/11/2022 22:15:09Also, if you're playing a blocking animation, the game will block so that players can't (normally) do anything. Depending on what you want to happen after the player dies, that may be sufficient. (For example play a blocking animation for ten seconds, then jump back to the main menu or show a Restart/Reload/Quit dialog.)
This is what I did for others player death (yes he dies a lot:)
But I can't do any blocking animation here because i want the spider to keep moving a little bit while the deeath music plays.
Quote from: newwaveburritos on Tue 29/11/2022 22:26:17One thing I have learned that I've found useful is that the player doesn't have to be the "player" the player just has to look like the player. If it's easier for you to use something else like maybe like maybe an object or even a GUI that can't move and keep the player as the player then you could do that rather than try scripting very specific behavior.
O yes this is a pretty good idea maybe i will make an object using the last frame of the death loop and make the character(player) invisible for exemple.
That sould work.
Thank you.
Quote from: actaria on Tue 29/11/2022 22:29:32But I can't do any blocking animation here because i want the spider to keep moving a little bit while the deeath music plays.
You can have a non-blocking and a blocking animation running simultaneously, so if you make the spider animation non-blocking that shouldn't be an obstacle.
Here's one relatively quick way to do this:
Add this to the room script:
function on_mouse_click(MouseButton button) {
if (player.View == DEATH) ClaimEvent();
}
This will disable all non-GUI (i.e. room) clicks based on the view. ClaimEvent() tells AGS to no longer run the global on_mouse_click function after the room's, effectively disabling all global room click handling.
Quote from: Snarky on Tue 29/11/2022 23:15:26Quote from: actaria on Tue 29/11/2022 22:29:32But I can't do any blocking animation here because i want the spider to keep moving a little bit while the deeath music plays.
You can have a non-blocking and a blocking animation running simultaneously, so if you make the spider animation non-blocking that shouldn't be an obstacle.
Hello,
Now i have used this solution "will make an object using the last frame of the death loop and make the character(player) invisible for exemple."
But i was curious and went back to this room code:
-The spider kill the Character and i have some blood spreading on the wall (animation that goes till the game goes back to sxreen title)
So maybe i should've just put the blood animation on Blocking and maybe it would bave been ok my character wouldn't have been able to move till the game returns at title screen.
I am not giong to try because it's working well now and I am a lazy girl :-D
Tonight i am trying to learn Camera and it's not easy but i begin to understand how it works.
I have lots of room but none used camera yet so now it's time.
The scary spider
(https://zupimages.net/up/22/48/hhjg.jpg) (https://zupimages.net/viewer.php?id=22/48/hhjg.jpg)
Quote from: Khris on Wed 30/11/2022 08:56:50Here's one relatively quick way to do this:
Add this to the room script:
function on_mouse_click(MouseButton button) {
if (player.View == DEATH) ClaimEvent();
}
This will disable all non-GUI (i.e. room) clicks based on the view. ClaimEvent() tells AGS to no longer run the global on_mouse_click function after the room's, effectively disabling all global room click handling.
Hello,
This is exactly what i was looking for
I will try it for the next player death :-D
Thank you
Maybe it's just me but if all you want to do is not have the player not being able to move temporarely? Why not just go.
RemoveWalkablearea(1);
And then have a wait command and reload the room or whatever for a new attempt to not "die" and call setWalkablearea(1);