multiple enemies shooting bullets at the same time

0 favourites
  • 7 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello!

    I ran into a new problem.. I have multiple shooting enemies on the screen at the same time, but only one at a time is shooting.. If I kill the shooting enemy the next one will begin shooting

    Screenshot:

    Code:

    You guys have an idea?

  • Add a "For each" (system condition) before the on-screen check

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • like this? does't work Still only one enemy is shooting and the others don't even start der shooting animation now :O

  • For each as subevent after 'System| every 1.0 seconds' or you could use instead of 'System| create object', 'Kanobär|Spawn Fireball ...', but then all of your sprites will fire at the same time.

    If you don't want that use 'System| Pick a random instance -> System| Create object...' as subevent after 'System| every 1.0 seconds', that will randomly choose an instance that fire a fireball.

  • awesome! that works! you both rock <3

    is there a way to let them shoot one after another?

  • Yes, its possible. The easiest is to use 'Pick nth Instance .'

    System| Every 1.5 seconds
        local static number x=0
        System| Pick kanobär instance x -> System| Create object Fireball on .....
                                        -> System| Add 1 to x
       
        System| x>= kanobär.count       ->System| Set x to 0
    [/code:14alquwr]
    
    You don't have to use a local static variable you could also use a global
  • A timer behavior on your kanobär sprite would work great.

    kanobär | On created -> Start timer "shoot" for 1.0 (Regular)

    kanobär | On timer "shoot"

    +kanobär | Is on-screen -> Your mirrored and not mirrored code as sub-events

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