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
61
S
19
G
6
Posts: 809
Reputation: 9,028

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
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

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
61
S
19
G
6
Posts: 809
Reputation: 9,028


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, blackhornet and 28 guests