How Can I Attached The Bullet To A Spawning Enemy Object?

Discussion in 'How Can I...?' started by jodenzle08, Sep 25, 2016.

  1. jodenzle08

    jodenzle08 Boxer

    Joined:
    Sep 25, 2016
    Messages:
    6
    Likes Received:
    0
    So I am creating an Endless Plane Shooting Game, I have created a Spawning object and assigned it as an enemy, I have created another object and used it as an enemy bullet with spawn component also, I have already connected it to the enemy object, the problem is, whenever the enemy Object spawns the bullet doesnt follow the path, please help, i am testing it on PC (EXE) since I am not able to preview it live (KEEPS ON CRASHING) , I am not yet able to test it on android/Ios, so my only way to test it is to compile it as an EXE file then play everytime.
     
  2. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Why can't you play the game in the viewer as normal? If its crashing, you need to check your Atlases and graphics because clearly something isnt right there. Are they too big? Do you have missing images?

    To make your bullet. Create a new Object - call it bullet(for example but you can name it anything)
    Then select the character you want to spawn the bullets from. In the shooting animation, place your normal shooting animation(if you have one) or image of your character
    Then, open the Shooting Animation Image pressing pencil icon to edit
    Drag in your bullet Object
    Change the properties of the bullet to
    Preset - Character Bullet
    Object Type - Fixed

    MOVEMENT -
    Linear Velocity 60/0 - for bullets to shoot to the right of the screen. The 60 is the speed. Higher the number, the faster they move.

    PROPERTIES
    Collision type - no collide
    Destroy type - destroy enemy

    ADD COMPONENT
    Spawner -
    Choose the spawn rate that suits
    Spawn Action - Single or perm shooting. again depends on your game.

    Place your bullet where you want it to spawn from the Character. Send it to the back(so it cant be seen)

    DONE.
     
    Christoph likes this.
  3. jodenzle08

    jodenzle08 Boxer

    Joined:
    Sep 25, 2016
    Messages:
    6
    Likes Received:
    0
    Thanks for your fast reply, but i still have a question.

    Since Buildbox 2.2.1 I am not able to preview any game samples, It keeps on Crashing whenever I press Preview button, I have also already sent an email to the support group yesterday with the crash Information.

    Just to clear my question, I am talking about the enemies bullet not following the when spawning enemy.

    1) I have an enemy object that spawns every 4 seconds(permanent) (airplane)
    2)I have attached an object to it and assign it as an enemy bullet with a spawn rate of 2secs (permanent)(airplane bullet)
    3)They are connected to each other
    4)I have created a LOGIC Path for the enemy object to follow


    now as soon as I play the game, the enemy spawns every 4 seconds and follows the path it was designated, but the bullet even though it is connected to the enemy that I assigned to spawn remains at the place it was before.

    what I want is when the Enemy spawns the bullet should also be attached to it.

    PS: sorry I dont know how to send bbdocs file here
     

    Attached Files:

  4. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Have you set the enemy spawners to enemy bullet?
     
  5. jodenzle08

    jodenzle08 Boxer

    Joined:
    Sep 25, 2016
    Messages:
    6
    Likes Received:
    0
    The Plane was set to Enemy and the bullet was set to enemy bullet, I have also connected them. it works fine withtout adding a spawner to the object(plane) but i need to create spawners since it is an endless mode with only single scene
     
  6. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Looking at that screenshot, your linear velocity is too low. Bump it up to -20.
    Then, set your spawn rate to 1. Right now, your bullet is going too slow, and spawning every 4 seconds. If you want rapid firing, reduce it even further to 0.5 seconds
     
    jodenzle08 likes this.
  7. jodenzle08

    jodenzle08 Boxer

    Joined:
    Sep 25, 2016
    Messages:
    6
    Likes Received:
    0
    It only speed up the enemy plane's movement but still the enemy bullet's position remains fixed.

    PS: I have created another one with different approach,

    1)created an object plane assigned it as an enemy
    2)created an object bullet assigned it as an enemy bullet
    3)connected them both
    4)set the spawn time and wake for bullet + velocity
    5)set the spawn time for enemy plane

    this time the problem was, the bullet is dragging the spawning enemy plane. so the spawning location isnt fixed.
     
  8. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    I don't think you can spawn linked objects. The linked object never will spawn unfortunately. Also, the bullets are already spawned so I would give you a double negative. You can't spawn a spawned object if that makes any sense... :D
     
    jodenzle08 likes this.
  9. jodenzle08

    jodenzle08 Boxer

    Joined:
    Sep 25, 2016
    Messages:
    6
    Likes Received:
    0
    So the only way is to spawn an object alone, isnt there a way that i could also give a powerup to the enemy? because if that thing would work i believe i could make a hidden power up to its path and make its animaation change in to something thats shoots
     

Share This Page