A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: ActionScript code for how to make enemies shoot?

  1. #1
    Registered User
    Join Date
    Sep 2021
    Posts
    1

    Question ActionScript code for how to make enemies shoot?

    Hi there. This is my first post and and it's an inquiry as to how to make enemies shoot bullets in AS2. I already have the main character shooting bullets, but for some reason can't get enemies to shoot them.

    The enemies are all generated using arrays and so are the bullets. So each enemy and bullet is a copy of the same movie clip.

    The problem is whenever there's more than ONE copy of the enemy on stage, the bullets only generate on that copy unless it's destroyed. Then they appear on the next copy, etc. etc.

    Also the collision detection only works for some of the bullets.

    I'm not great at programming, so all the code in my game is Frankensteined together from dead tutorial sites I've found online, and so I'm also hoping this is a simple thing to do.

    TL;DR would really appreciate if someone could just throw me some code so my enemies can shoot projectiles at the character.

  2. #2
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,203
    Well there is multiple ways to achieve this based on perspective and how the game is already being built. You should have the file open source for the time being and share the source file and later close the source again if this is a non-open source project.
    Last edited by AS3.0; 09-23-2021 at 05:36 PM.
    Today is going to be a long day -.-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center