Shoot In Two Predefined Directions, Alternating

Discussion in 'How Can I...?' started by adrian_pavel, Apr 8, 2017.

  1. adrian_pavel

    adrian_pavel Boxer

    Joined:
    Apr 7, 2017
    Messages:
    24
    Likes Received:
    12
    Hello everyone!

    I'm trying to create a game with a mechanic that I can't seem to figure out how to do in Buildbox.
    I need my character to shoot in two predefined directions (always the same), and I need it to shoot in an alternating fashion. To the left and then to the right on each of the player's tap/click.
    [​IMG]

    As you can see in the above picture, I will have enemies coming from the left and from the right. I want my character to shoot the enemies when they have reached a predefined position on the path. Also on the first tap only "Bullet spawner 1" should shoot, on the second tap only "Bullet spawner 2", and so on..

    Anyone got any idea of how I could achieve this in Buildbox?

    Thank you!
     
  2. adrian_pavel

    adrian_pavel Boxer

    Joined:
    Apr 7, 2017
    Messages:
    24
    Likes Received:
    12
    I've managed to come up with a solution to my problem and I'll describe it here. Maybe someone will find it helpful.

    For shooting in 2 different directions I've added a Switch button to the UI and linked two advanced moves on the character to the button's A and B states. In each of the advanced move's animations I've added a spawn object that will spawn the bullets for shooting left and right respectively. The spawn objects are set to Permanent, with a Spawn Rate of 0.2.
    For the alternating part, I've changed the timeout of the Advanced Moves to 0.2 to match the spawn rate.
    Now on each tap/click, the characters shoots a bullet to the left, then to the right and so on.
     
    Jaro and Phill Mason like this.
  3. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    I love seeing people answering their own questions :)
    I really like what you've come up with there, looks like a fun gameplay style, thanks for sharing.
     
  4. adrian_pavel

    adrian_pavel Boxer

    Joined:
    Apr 7, 2017
    Messages:
    24
    Likes Received:
    12
    Thank you! :) It means a lot.
     
  5. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    Wow, love the out of the box thinking here. :)
     
    adrian_pavel likes this.
  6. adrian_pavel

    adrian_pavel Boxer

    Joined:
    Apr 7, 2017
    Messages:
    24
    Likes Received:
    12
    Thank you! :) Glad you like it!
    I hope someone will put the method to good use because I've changed my design in the mean time.
     
  7. sebb121

    sebb121 Boxer

    Joined:
    Dec 10, 2017
    Messages:
    75
    Likes Received:
    56
    I just want to say that this helped me (2 years after the OG post). THANK YOU!
     
  8. Jaro

    Jaro Avid Boxer

    Joined:
    Sep 21, 2018
    Messages:
    387
    Likes Received:
    127
    great JOB !!!!!! its verrrry helpfull for my new project .
     

Share This Page