shoot left when facing left, shoot right when facing right - HELP!

scitunesscitunes Member, Sous Chef Posts: 4,047
edited November -1 in Working with GS (Mac)
I want to make an actor that shoots. When he is walking right or facing right i want the spawned bullet to fly right. When he is walking left or facing left I want the bullet to fly left.

What's the best way to do this?

Thanks!

Comments

  • TheTTheT Member Posts: 80
    I think there are already some posts delaing with this, but to make it quick: Create an attribute in the actor which switches if "key right" and switch to another state "if key left". Than create a rule which checks if this state is "1" or "0" and then spawn the bullet in angle 0 or 180. That should do it already :)

    Hey, you are that dude who made this bloodcells game, aren't you ? Just played it, where did you get that song ? :P
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I am a songwriter and science teacher. I am also working on creating a multimedia human body curriculum that uses music, reading, writing, and you guessed it video games to engage students.

    www.scitunes.com/music

    Thanks for the help, guys!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Thanks for the link, codemonkey. That makes sense. So when I use that method to check which way the actor is facing how do I get it to shoot in that direction. Do I create two different actors (bullet left and bullet right) and give each one a different direction in the accelerate behavior? Will all that spawning be a problem?
  • Fafnir312Fafnir312 Member Posts: 161
    @scitunes: Heh! Nice songs on your site :) Are you the guy singing?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    actually, I'm doing all the parts - not at the same time of course ;-}

    Thanks for the positive feedback!
  • TheTTheT Member Posts: 80
    Just make a variable and give it the 0 or 180 accordingly when you spawn the bullet. The bullet just needs a basic move behavior.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    @scitunes: In regards to memory usage, if they don't have too many rules it should not be too much of a problem. Just don't go overboard. If you can make it one actor it would be better than 2. Just do as TheT suggests and use the expression editor to determine direction of the move or change velocity behavior. And don't forget to use a Change Image as well, if you need to show direction of the bullet.
Sign In or Register to comment.