Need some array help

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello, needs some help with this array, working on a ship that fires..

    the cannons in the ship are in an array, but when shooting (pressing space), i want to check every array, if it can shoot,(arrayvalue is yes), if shot, set that arrayvalue to "no" so it stops shooting until that cannon reloads

    i seem to get only at the first array, (one shot is cancelling out)

    so i think my loop is wrong or something


  • A little reorganising in your code, remembering that arrays are 0-based (they don't start at 1 but at 0), some fixing and here is :

    The capx

    So the reloading, instead of occuring each frames is set in a group that is activated only one second after a shoot.

    Your present code is a bit strange though, since you have potentialy 20 canons, and only use 6 of them, hard-"encoded".

    Anyway, I hope it helps you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for the help Kyatric,

    yes for the moment i was trying to get the first six going, depending on upgrades you could get 18 cannons in total/ 9 on each side, hopefully i can get that to work

    i was messing with the loop number because the imagepoints i needed started at 1, but it was wrong approach i guess

    thanks again

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