how to have random spawn not spawn on top of main actor

Cee3pee0Cee3pee0 Member, PRO Posts: 194
edited November -1 in Working with GS (Mac)
Is there an easy-ish way to have the "bad guy" actor not spawn on top of the main actor when it is set to spawn in a random x,y position? thanks in advance

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Cee3pee0, if your player is on the move, you might have a bit of trouble making sure the baddies don't spawn on top, (it's possible but won't be accurate enough, I don't think). But if your player is stationary when you're spawning a baddie, after your random x and y to place your spawned actor, you need to compare it with the x and y of the stationary player; if it matches, up to + or minus 80 (for instance) for x, or + or - 80 for y, (still based on the x, y of the player) then random again before spawn; if not, then OK to spawn.

    That's it in a nutshell, anyway. Think it's right, and hope it helps.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I had the same problem. Here is what I did (it doesn't solve the problem but was an acceptable work around for me).

    I created a self boolean attribute in my enemy actor called self.active. then this rule:

    Rule
    when self.time=2 (or whatever time you like)
    change self.active to 1

    Then wrap all of your rules for this actor in a rule that says when self.active is true.

    Then put an interpolate behavior before the self.active is true rule (not in it) and interpolate the alpha to 1. Be sure to change the alpha to zero in the actor panel on the left side of the screen. What this will do is cause the actor to be spawned and slowly fade in. The actor will not be active and will not hurt your player (assuming rules for hurting the player are in the enemy actor and not the main player actor) until self.active is true.

    So from the gamer's prospective if an enemy is spawned under the main player there will be 2 seconds to get away from the enemy as it fades in. This is essentially how it is done in tilt to live where the new red dots do not hurt for the first .5 seconds or so.
Sign In or Register to comment.