how do i make an actor come back to life after i destroy it

THINGTHINGTHINGTHING Member Posts: 84
edited November -1 in Working with GS (Mac)
how do i make an actor come back to life after i destroy it

Comments

  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Can you be more specific?
  • HachikoHachiko Member Posts: 330
    Wait for Jesus.
    Or spawn a copy of the actor that was destroyed.
    You can't take back the same actors that you destroy, but if you need that actor again, you can spawn it, or, instead of kill it, change its x and y position to take it out of the screen. When you need it again, just change it again its x and y position to take it back to the action :)
  • reddotincreddotinc Member Posts: 653
    If you "destroy this actor" then you will have to re-spawn it.

    Otherwise, set the alpha to 0 and change attributes to off screen, then when you need it again, change the attributes to be on screen and change the alpha to 1.

    // red.
  • FranzKellerFranzKeller Member Posts: 517
    I believe "there is no return!" for an actor after a destroy command

    SO

    You could just turn it invisible temporarily? If you think you want to have it reappear later

    There is an attribute called visible I think that can be turned to false.
    Or change the color alpha to zero
  • ORBZORBZ Member Posts: 1,304
    visible=false is only a design time thing. It tells the graphics pipeline not to render your object, it's an optimization thing. To make something temporarily invisible set alpha to 0.

    But remember, just because something is invisible doesn't mean it can't still be collided with. To make something both invisible and unable to be collided with move it off camera, not too far though because the GameSalad engine automatically destroys objects that are moved too far off camera.

    However, if you don't want to go through all the trouble of moving stuff off camera and then back on (which in my opinion is a major pain in the butt) you can just make a rule that says:

    rule when self.alpha > 0
    collide

    that way collisions only happen if alpha is greater than 0, i.e. visible.

    This prevents you from the trouble of having to move stuff off screen. The downside of course is that the collision logic is inside the thing being hidden. This can be a good or a bad thing. Depending on how many of these "hiding" actors you have. Ideally you want to have your colliders on the fewest possible things. I.e. it's better for the single player actor to collide with many walls than for many walls to collide with the single player. It's a matter of how many objects are testing for collision. Is just the single player object testing for collision vs is every single wall testing for collision? ... etc.

    I think i've gone a bit off topic. You'll have to make the best call for what works for you.

    - Move off screen
    - destroy / respawn
    - set alpha=0
    - set alpha=0 w/ collision checks
  • THINGTHINGTHINGTHING Member Posts: 84
    sorry i already figured it out
    once the actor overlapps or collides with whatever kills your actor reset scene
  • chicopchicop Member Posts: 263
    ORBZ said:

    However, if you don't want to go through all the trouble of moving stuff off camera and then back on (which in my opinion is a major pain in the butt) you can just make a rule that says:

    rule when self.alpha > 0
    collide

    that way collisions only happen if alpha is greater than 0, i.e. visible.

    - Move off screen
    - destroy / respawn
    - set alpha=0
    - set alpha=0 w/ collision checks

    Just found this post.. it solved a 2 week long mystery for me.. very awesome thanks!
  • TaidakenTaidaken Member Posts: 271
    jacobg99 said:
    sorry i already figured it out
    once the actor overlapps or collides with whatever kills your actor reset scene

    hmm i dont think thats a suitable solution for ur problem..
  • TaidakenTaidaken Member Posts: 271
    hmm skip that.. just realised that this guy was wanting to know this a month ago... so yeah.. nevermind.
Sign In or Register to comment.