How do I have random objects appear (as projectiles)?

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Well, just looking for a way on how to get/use randomizers/RNG for Construct 2. In my case, I want a enemy to shoot a common projectile, but say, every 1 outta 7 shots, the enemy will shoot a different projectile.

    Didn't see any actions/behavoir blocks for RNG...

  • You use variables with event actions.

    On your shooter sprite put an instance variable.. say enemyShot=0

    Now prior to or in your shoot event initialize variable using action set variable enemyShot=random(0,6), or enemyShot=(choose1,2,3,4,5,6)

    Then use System compare instance variable and = 1 then action whatever, = 2, etc.. or in your example enemyShot<=5 regular shot >=6 special shot. (0 = 1.. so 1-7 is actually 0-6 in Construct2)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You use variables with event actions.

    On your shooter sprite put an instance variable.. say enemyShot=0

    Now prior to or in your shoot event initialize variable using action set variable enemyShot=random(0,6), or enemyShot=(choose1,2,3,4,5,6)

    Then use System compare instance variable and = 1 then action whatever, = 2, etc.. or in your example enemyShot<=5 regular shot >=6 special shot. (0 = 1.. so 1-7 is actually 0-6 in Construct2)

    I will try that out, thanks...let you know if it works, Also, I'm using the Turrent behavior to fire the projectiles; not sure if that will affect anything...

  • You may have to use the turrent built in actions to change its projectile type based on your variable value would be all I would think.

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