A Flash Developer Resource Site

Results 1 to 5 of 5

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,217
    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.
    non-contrib

  3. #3
    Junior Member
    Join Date
    Aug 2021
    Posts
    6
    I am learning as3 and I am kind of new to this. I am trying to get my enemy to shoot three bullets and so far I got that part done. However, I am stuck on making them go in different directions and they all just go in one directions instead. Here is an example of the code I am using in as3.

  4. #4
    Junior Member
    Join Date
    Aug 2021
    Posts
    6
    I do not think they are checking at all unless sums keep growing. But I never used my credit card for gambling. Instead, I prefer safe games that are available for free. I have found many resources that offer you to have some fun testing games, for example https://polskie-kasyno.com/kasyno-online/. This site also provides other helpful information about online casinos.

  5. #5
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,217
    Weaver did you attach the source?

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