spawn actor goes in the player direction

emojiemoji Member, BASIC Posts: 66

Hello, would someone assist with this issue? below is my player behavior.

and this one is my projectile actor behavior aka power

so my player can move left and right just fine when I press this button it shoots power but I just notice that (when facing right or vice versa) once I shoot and then decided to move left, the power will move left just like the player. I'm trying to figure it out but if someone has experience with this before please share. thank you.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    What happens if you turn off ALL of the rules & behaviors in the power actor except that Move behavior? And then what happens when you turn of the Move behavior as well?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • emojiemoji Member, BASIC Posts: 66

    update I think I found the problem but I don't know how to solve the problem. so basically my player behavior has two attributes. the walkRight will change to false when I move left and I think this cause my power to move left and the shoot will only become true when I press the button. I hope this would give some more details for helping to solve this problem.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It's not really clear from the screenshot you posted because it doesn't show how those attributes are changing value.

    You may want to upload your project file (.zip it first) so that all of the rules are visible.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • emojiemoji Member, BASIC Posts: 66

    hi, I can't upload the project cause it will give away my secret but basically when user press button to walk left or right the attribute walkLeft or walkRight will be true( it one or the other) and when the user press the shoot button the shoot will become true and become false after release. for example when the player is walking right and I press the shoot button then the player will shoot power out and then if I decided to move the player left after I shoot the walkRight will become false and the power will shift its move directly to the left. Im gonna recreate this sample sometime tonight and upload here once I get home from work.

  • Twayne2Twayne2 Member Posts: 458
    edited August 2018

    I don't really understand exactly what your issue is. Something about when your player shoots?
    On a side note...shouldn't there be three options? Walkleft is true when going right, false when going left, but how about when not moving? Using integer attribute could easily solve this, if you even want to, by just using 0, 1, and 2.

  • Twayne2Twayne2 Member Posts: 458

    A file would be nice to look at.

  • Cutscene EntertainmentCutscene Entertainment Member, PRO Posts: 138

    • In your projectile behavior, take the 'move' and 'animate' behaviors out of that "shoot right" rule, then get rid of the empty rule.
    • Rename your projectile actor to "power right".
    • Create a duplicate of that actor, change its 'move' behavior's direction to 180, and call this duplicate actor "power left".
    • In your player actor, look at the "power right" rule and make sure the 'spawn actor' section is set to spawn 'power right'.
    • Duplicate the entire rule, and change the duplicate's first attribute to game.walkingLeft (if that's what your left attribute is called).
    • Make sure this duplicate's 'spawn actor' section is set to spawn "power left".
    • Click "Preview" and see if it works.

  • emojiemoji Member, BASIC Posts: 66

    I kind of solve the problem. I put a timer on the shoot and walkRight. it is enough time for my power to hit the enemy or exit the screen and get destroy. so that way when my player decided to walkLeft after shooting the power still travel opposite the player direction.

  • Cutscene EntertainmentCutscene Entertainment Member, PRO Posts: 138

    @emoji said:
    I kind of solve the problem. I put a timer on the shoot and walkRight. it is enough time for my power to hit the enemy or exit the screen and get destroy. so that way when my player decided to walkLeft after shooting the power still travel opposite the player direction.

    If it works, it works. ;)

  • mikejamesfishermikejamesfisher Member Posts: 88

    I think i have a thought on this... ah yes, there it is. Perhaps and accelerate toward instead of move the shot. Put it in a timer for a second and check run to completion. You can also put a max speed on the shot if it goes too fast. That run to completion should make the shot continue toward right or left.

Sign In or Register to comment.