Help WIth Actor Spawning

foraliforali Member Posts: 7
edited November -1 in Working with GS (Mac)
I am creating a game that requires when you press number keys 0-1 it would change/spawn the character assigned to the key, so if i press 1 it spawns character1, and if i press two it spawns character 2. Okay I have the rule set if key 1 is pressed spawn char 1, that all works, but the problem I am having is when i spawn character two it will not delete character one, so character two just stays on screen. i have the rule under the spawn that says if key 2 is pressed destroy actor one.(yes i realize i after to do every other key except one to have it destroyed) But this isnt working. Does anyone know how to solve this?
Thanks

Comments

  • AppsRacKAppsRacK Member Posts: 346
    The question is, does it really necessary in your gameplay to destroy the actor? Why not just move it off the screen when you pressed the button.
  • foraliforali Member Posts: 7
    Would moving it off screen eliminate the actor firing when I hit the fire button?
  • foraliforali Member Posts: 7
    And, what x and y coord would be needed to be off screen
  • AppsRacKAppsRacK Member Posts: 346
    I'm trying to understand what your trying to accomplished and heres what i came up. If you want to change actor type with a push of button you could actually accomplished this without spawning and destroying by just using 1 actor, 1 attribute and 1 rule.

    -create a global attribute and name it ActorID and set it to integer.
    -in your actor make a rule
    RULE
    ->if game.ActorID = 1
    -->change actor image to type 1
    ---> spawn bullet type 1
    otherwise
    -->change actor image to type 2
    ---> spawn bullet type 2

    In your button change the glocal attribute ActorID to 1 & 2 when press accordingly. There it is, no moving off screen and no destroying.
Sign In or Register to comment.