GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Switch between controlling two different actors

scitunesscitunes Posts: 4,047Member, Sous Chef
edited November -1 in Working with GS (Mac)
I have a platform game with two main actors in it and a bunch of bad guys. The first actor's job is two find the bad guys and reveal their identities (by colliding with them). this collision causes the bad guys to spawn a new bad guy with their identity revealed. When actor one has finished IDing the bad guys you need to go back to the beginning and find actor two. Then this actor goes and shoots the bad guys. I want to use the same control scheme for both actors (arrows and spacebar). So I created a boolean attribute so that when you click on actor one the arrow keys control it and when you click the mouse on actor two the arrow keys control it.

Here's the problem. when I put actor one in the scene and test it out everything works. Actor one causes the bad guys to spawn the new IDed badguys when it collides with it. But then I add actor two to the scene and everything works until actor one collides with a bad guy. then it crashes and GS shuts down.

Any ideas? Thanks guys!

Comments

  • CodeMonkeyCodeMonkey Posts: 1,803Head Chef, Member, PRO
    Does each one have a control camera?
  • CodeMonkeyCodeMonkey Posts: 1,803Head Chef, Member, PRO
    Does each one have a control camera?
  • scitunesscitunes Posts: 4,047Member, Sous Chef
    I created a game attribute called camera follow (boolean). In each actor I created a rule when clicked on change attribute to... (one actor gets true the other false)

    Then in actor one it says when camera follow is true - camera follows me
    In actor 2 it says when camera follow is false - camera follows me

    I also had to add each condition to each movement rule (left right and jump) so that only the actor that is controlling the camera will respond to the left right and space keys. Other wise they would both be moving around together.

    Everything seems to work fine as far as switching back and forth between the two actors. But then when actor one collides with a bad guy in order to reveal its Identity (which is really just a spawn actor behavior) GS crashes.

    Thanks for responding.
  • scitunesscitunes Posts: 4,047Member, Sous Chef
    do I need to create a third actor that is invisible and constrain its xy to either actor 1 or 2 depending on the camera follow boolean game attribute. And put the camera follows me behavior in the invisible actor? Would that help?
  • scitunesscitunes Posts: 4,047Member, Sous Chef
    Could it be the spawn behavior causing it to crash? When actor one collides with a bad guy the "unknown" bad guy is destroyed and a new "revealed" bad guy is spawned. This works fine when actor 2 is not in the scene. when I put actor 2 in the scene I can switch from one actor back to the other by clicking on them and everything seems to work great and then I collide actor one with a bad guy and GS crashes. I can't figure out why having actor 2 in the scene would effect how actor 1 and the bad guy collide.

    totally stumped!
  • scitunesscitunes Posts: 4,047Member, Sous Chef
    when I take the spawn behavior out of the bad guy behaviors GS does not crash. It seems weird that only one spawn behavior is enough to crash GS. I know I have a lot of other things going on, but could it really be that one spawn behavior is enough to crash it.
  • scitunesscitunes Posts: 4,047Member, Sous Chef
    Does anyone else have a game in which they switch between two main actors in the middle of a scene? I'd love to know how other people are attempting to accomplish this. Thanks!
This discussion has been closed.