Need some array help

Get help using Construct 2

Post » Tue May 08, 2012 6:01 am


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


capx
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Tue May 08, 2012 7:11 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,293

Post » Tue May 08, 2012 7:49 am

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



ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, senecaa and 22 guests