Scene Not Recognizing Actor As Dead

magolord

  • Posts: 29
I've had a block of code that has been functioning for the past week exactly as it should--when the actor leaves the scene, kill it. I don't know what I did in the past hour, but now when the actor falls of the scene it's not recognized as killed. I have a completion meter at the top of the screen that only runs when the actor is alive, and since it still continues to function after the actor leaves the screen it's clear that the scene thinks it's not dead.  I've tried changing up the code block a ton, but nothing is working. The actor still dies when it hits obstacles, so I don't think it's an issue with the kill Self block itself.

The first attachment is the code block I used to kill the actor when it left the screen--everything worked until today.
The second attachment is a snippet of my scene from the builder, I thought initially that the scene recognized the overhanging platforms as part of the scene and removed them, but still no luck.

Let me know if you need more information/photos.

magolord

  • Posts: 29
Also, forgot to mention that I have a separate code block in my scene events, it restarts the scene when the actor is killed.

merrak

  • *
  • Posts: 2738
Is the actor set to always active?

magolord

  • Posts: 29
Good point, but no. Only the platforms, enemies, and coins are.

Demkamen

  • Posts: 124
If this code attached in actor: after kill self, any next block codes not  will  work!(behavior dies with the actor).
You should put similar code in scene behaviour(and drag and drop blue block "the actor" to kill block if you already made it in scene behaviour)

« Last Edit: June 11, 2016, 12:30:15 am by Demkamen »

magolord

  • Posts: 29
Like I said, I do have another code block in the scene events that restarts the scene. I've even tried attaching the "Die When Actor Leaves Screen" behavior onto the actor, but nothing works. No idea what I did wrong; I have a backup of the game from yesterday which still works fine.

I did recently swap out the sprites for the main character, and just changed the animation names to match after deleting the originals. Would that be an issue?

Demkamen

  • Posts: 124
no. Sorry not clear about organization code in your game. The Issue in scene behaviour named "Desert"? Give full screnshoot with it, and mark place with problem

KramerGames

  • Posts: 405
Is the first block you posted under events for the actor? What happens when you change the first line "when actor exits the scene" to "when self exits"  and switch scene to screen?

Apart from that and even though you said it had worked before, I would suggest you start using attributes. When the actor is created, set an actor attribute to it and kill it via the attribute. Might come in very handy when things get a bit more complex and it keeps everything clearer.
Parasites United  (Idle Parasite Game)

Justin

  • *
  • Posts: 4716
Sorry, I don't have time to look into this and help you solve it right now, but I wanted to clarify a point that could be misunderstood.

Quote from: Demkamen
If this code attached in actor: after kill self, any next block codes not  will  work!(behavior dies with the actor).
You should put similar code in scene behaviour(and drag and drop blue block "the actor" to kill block if you already made it in scene behaviour)
For this situation that may seem to be true, but it's not (really) the case. You can place [kill self] at the beginning of an event, and the rest of the blocks in the event will still run. However, since the only block you have after it is a timed event, it won't have any effect, since the timed event will be canceled upon actor death.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

magolord

  • Posts: 29
no. Sorry not clear about organization code in your game. The Issue in scene behaviour named "Desert"? Give full screnshoot with it, and mark place with problem

Is the first block you posted under events for the actor? What happens when you change the first line "when actor exits the scene" to "when self exits"  and switch scene to screen?

Apart from that and even though you said it had worked before, I would suggest you start using attributes. When the actor is created, set an actor attribute to it and kill it via the attribute. Might come in very handy when things get a bit more complex and it keeps everything clearer.

This is the code block that's causing the problem, it's listed under the Actor (Jub) events and is meant to kill the actor when it leaves the screen. (To be specific, the second line "kill the actor" isn't functioning.) There is a separate block in the scene events (Desert) that restarts the scene once the actor is killed, so the "Crossfade to Desert After 0.5 Seconds" block is repetitive.
I've tried removing this block but nothing happened, so I left it in there because it worked in the game backup file I have. I tried putting this block in the Desert events, but that didn't work either.
I tried adding an Actor attribute (Jub), and even though the attribute is linked to the correct actor type it hasn't worked. I went through the game backup file and checked every single event for the actor and scene, and they're exactly the same. Except the game backup works, and this doesn't. I'm stumped.

« Last Edit: June 11, 2016, 01:21:01 pm by magolord »

merrak

  • *
  • Posts: 2738
Good point, but no. Only the platforms, enemies, and coins are.

Did you try having it on?

magolord

  • Posts: 29
Did you try having it on?

Just tried. Still not recognizing the actor as killed.

Basically the main issue is that the game either doesn't recognize what the scene/screen boundaries are (the actor can only fall down, not to the left/right of screen), or it just doesn't kill the actor when it leaves the screen. The kill block works for other instances, like collisions, so maybe I'll just have a giant sensor that runs the width of the screen and use it to restart when the actor hits it.

merrak

  • *
  • Posts: 2738
The next step would be to start putting print statements around the code you're not sure is executing. Putting a print before/after the kill actor block will let you know whether the issue is the kill actor block not executing, or the leave screen never being detected.

magolord

  • Posts: 29
The next step would be to start putting print statements around the code you're not sure is executing. Putting a print before/after the kill actor block will let you know whether the issue is the kill actor block not executing, or the leave screen never being detected.

Yup, I tried executing the actor event "kill self when exiting screen" with a confirming print statement, and the log viewer didn't recognize that the actor had left the screen. Now I'm wondering why it doesn't see the scene boundaries.

So I've singled out the problem as that "when actor exits scene" block, no idea why it isn't functioning. It works fine on the backup game.

« Last Edit: June 11, 2016, 08:54:51 pm by magolord »

merrak

  • *
  • Posts: 2738
My best idea was that it was going off screen and no longer updating. It sounds like that idea is out, though. I'm not sure I can figure it out without doing some experimenting.

I usually program this sort of behavior manually:

Code: [Select]
Always Event:
    if y of actor on screen > screen height then
        kill self
    End if

That might be a better solution all-around. The reason I don't use the 'when actor leaves screen' events is that they give you no control over the margin. The actor position is the upper left corner. See Hectate's comment over here: http://community.stencyl.com/index.php?topic=13665.0