Shooting Enemy

  • I've looked everywhere for this but nothing gives me a straight answer.

    How do I make an enemy shoot at me?

    This enemy doesn't move and it doesn't look around. It shoots in a straight line to the left. The thing it shoots will usually hit a wall, I want it to be destroyed upon hitting the wall.

    It has a shooting animation, a reload animation and an idle animation.

    How do I do it? Please explain it to me in an easy to understand way ^-^

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Something like:

    Every x seconds

    enemy spawn bullet

  • That doesn't really help me at all (^-^;)

  • That doesn't really help me at all (^-^;)

    Well if you could explain better what you want, it would be easier to answer your question..

    It sounds like you want your enemy to shoot at time intervals, so that's what I explained..

  • "How do I make an enemy shoot"

    Then i proceeded to tell you how the enemy works. Does not look around, does not move at all.

    I want to make it shoot in a straight line either left or right.

    If it's bullet hits a wall, then the bullet with disappear.

    It has a shooting animation, an idle animation, and a reload animation.

    I think I explained it pretty well.

    One thing I failed to mention however is that I would like it to shoot ever 2 seconds or so.

    To put it simply, I need a way to make the enemy shoot after the "Shoot" animation, to "reload" after it's shot, and to idle in between shots. I also need to figure out how to make the bullets appear every 2 or so seconds over and over again.

  • System every 2 seconds

    • enemy play shooting animation
    • enemy spawn bullet..

    bullet on collision with wall

    • bullet destroy

    enemy on shooting animation finished

    enemy play animation idle

    to shoot in a straight line either set the bullets angle of motion to 0 (right) or 180 (left) degrees

    now the only question left is how often the enemy has to reload..

  • How do I get the enemy to spawn a bullet? What behaviors do I need to add to the enemy? What are the properties I need to give to the bullet sprite? What behaviors do I give the bullet? How do I make the bullet go the way I want it to?

    Help me out a little : P

  • How do I get the enemy to spawn a bullet?

    see LittleStain's last answer

    What behaviors do I need to add to the enemy?

    None for this action... You just need animations

    What are the properties I need to give to the bullet sprite?

    As LittleStain writes, set the angle of motion... and the speed

    What behaviors do I give the bullet?

    Seriously..... https://www.scirra.com/manual/90/bullet

    How do I make the bullet go the way I want it to?

    As LittleStain writes, set the angle of motion

    Help me out a little : P

    it might help https://www.scirra.com/manual/1/construct-2

  • Sorry for being a beginner I guess. I'll try that stuff out.

  • No problem ... I'm just trying to clarify. ^^

    You should try to do something with these early indications and I advise you to train yourself with the tutorials . They help to start and to learn the basics of C2.

    Enjoy

  • I can't for the life of me figure out why the bullet is going right when I set it to 180 degrees (left)

    I have the events set up like this

    Event:

    System | Every 2 Seconds

    Added Conditions:

    Enemy | X is animation "Reload" playing

    Enemy | Is animation "Shoot" playing > Spawn bullet on Layer 2 (Image Point 1) > Set Bullet angle of motion to 180 degrees

    Next Event:

    Bullet | On collision with wall > Destroy

    Next Event:

    Enemy | On animation "Shoot" finished > Enemy set animation to "Reload"

    Enemy | On animation "Reload" finished > Enemy set animation to "Shoot"

    I removed the idle animation as it is not needed. It is simply Shoot > Reload > Shoot now. Please help me fix the bullet issue!

  • Bump bump!

  • Just add condition to set angle of motion of the bullet = the angle of your enemy

  • Where do I put the condition? I don't think it'll work with one anyway.

    The problem I'm having is that even though i've evented the bullet's angle of motion to be 180 degrees, it still travels right. If I change it to 0, it still moves right. I need it to go left.

  • Where do I put the condition? I don't think it'll work with one anyway.

    The problem I'm having is that even though i've evented the bullet's angle of motion to be 180 degrees, it still travels right. If I change it to 0, it still moves right. I need it to go left.

    The event should work as intended, could you share your eventsheet and/or capx to see what is wrong?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)