Destroy and spawn actor issue

eTroneTron Member Posts: 2
edited November -1 in Working with GS (Mac)
I have a actor that collides with another and spawns an explosion actor then destroys it after .5 seconds. I then want to re-spawn the first actor after 2 seconds. I can't get it to re-spawn unless I take out the destroy actor but then it leaves the last frame of the explosion on the screen. How do I destroy the explosion and respawn the first actor?

Comments

  • rebumprebump Member Posts: 1,058
    Have another actor, called "SceneController" or "PlayerSpawner" or what not that controls things such as re-spawning the player when necessary, spawning enemies every x seconds, looking for end-of-scene/game conditions (if it fits), etc.

    I usually go with "SceneController" myself.

    You can do other things like move actors way off screen for "death" and then back on for the re-spawn. Lots to play around with and different ways to handle a given situation.
  • design219design219 Member Posts: 2,273
    You could try not destroying the first actor... just use a timer to switch it to invisible (alpha 0) for two seconds.
  • rebumprebump Member Posts: 1,058
    I'd recommend moving it off screen to a coordinate pair that won't be detected by stray actors (i.e. bullets or what not). If you just alter the alpha to zero, it can still participate in collision detection I believe.
  • design219design219 Member Posts: 2,273
    Yes, you're probably right. But you could change the density couldn't you?

    or maybe change the size to 0x0?
  • rebumprebump Member Posts: 1,058
    Yeah, those might work but I now the X/Y position works well, especially if you have "wrap" enabled or you roll your own "wrap" rules. Just be sure to use a place offscreen that is not diagonal from the corners outward since a small actor could theoretically sneak through "wrap" rules where the X/Y rules meet (which I had to account for just last night...so now I move them off to the left at about X = -25 and Y = 160).
  • design219design219 Member Posts: 2,273
    I guess what conserns me about the move thing is it would be a bit complex to recor and return to the explosion spot.
  • rebumprebump Member Posts: 1,058
    Good point. I guess it depends on where you have it respawn then as to what you do! :-)

    I usually have a spawn point or a spawn ruleset to spawn away from a quadrant full of enemies but if you respawn at the point of death, then if your density or size methods work, then definately use those.

    Does resizing the width/height size attributes also resize the collision box? I hear the "Change Size" behavior does not but that is mainly for growing unless you start it off at a larger size to begin with. Lots a considerations...good old GS! :-)
  • rebumprebump Member Posts: 1,058
    I had a chance to test collision size when resizing with both the "change size" behavior (the collision box remained the original size) and when altering the width/height attributes (the collision box re-sized with the image). So if you want to re-spawn at the location of the death, then using design219's method of changing to a small size should work (unless you are overlapping another actor still that will force another collision detection).
  • seymourseymour Member Posts: 56
    If the actor wins or looses how do I change it to that scene? I let the actor use up all its lives and I can't figure out how to bring up the my you loose scene. Can any one tell me how to make it work. Thanks.
Sign In or Register to comment.