ARRAYS & LOOPS FOR DUMMIES...

For questions about using Classic.

Post » Fri Nov 23, 2012 8:38 am

Hmm, that's strange, I can't replicate the issue you're having. I've modified the cap file to make used entries blank though for easier debugging: https://dl.dropbox.com/u/4714446/ArrayPowerups.cap

A simpler work-around is to create 10 sprites of size 2x2 (power of two textures won't cause any real issue on the graphics card), and position them way outside the layout.

Have their powerup ability as a private variable and then when the player touches the object sprite, you pick one of the the powerup selector sprites at random, grab its powerup variable and destroy it. This way we rely on Construct Classic's internal arrays

I'll make a cap file of that method if you'd like
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Fri Nov 23, 2012 8:52 am

Mmmm,that's odd...I will try the cap again,and let you know how I do.

Thanks for taking time out to check and amend the cap,the hidden sprite idea,maybe food for thought,too.and if it's no problem be worth looking at as an option.

thanks again.

As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Fri Nov 23, 2012 10:05 am

....Ok,just to add to my confusion,trying your original cap again,it seems to be working perfectly...all I can think of is that I moved/deleted a condition or event inadvertantly...ooops...sorry!

I will go over my project again later...and let you know how I get on...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Fri Nov 23, 2012 11:54 am

Heh glad to hear it's working at least! Good luck with your project
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat Nov 24, 2012 3:02 pm

Ok,Jayjay,I have muddled together a mixture of your way and mine as my project involves the sprites being destructable,which I think was causing issues with your method in my game...still not 100% on loops,how do I use a loop to check a variable...once the first condition is met...the loop checks through possibles and if one (or more)is a "hit"> do something...if not carry on regardless...I can only seem to get the first checked or a constant flow of hits...how does a sub event differ from a condition inside the main trigger?

can I just add thanks,for your help...and loops do my head in...lol
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sat Nov 24, 2012 9:17 pm

A bit off topic but how do I open these .cap files? I'm trying to use Construct 2 to open them. And how do I create them from my own project? Thanks
B
10
S
3
Posts: 102
Reputation: 1,888

Post » Sun Nov 25, 2012 3:02 am

@farmerdwight, ah you'll need to download the free Construct Classic to open them (version R2 is in the General Discussion forum I believe). It's not too different in event styling though, so you might be able to port them over!

Hmm, @Pixel perfick a sub-event will only trigger if the main event does, and any objects picked will be carried on (eg: in a main event if you say "Object1 value hit = true" then it will only select all of the Object1 objects with a hit value in the first place).

One way to avoid picking any objects in the main event is by doing a System "Compare". Can you explain a little more about what you want to be done and I'll try making a cap file?

And no problem, happy to help Jayjay2012-11-25 03:02:26
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Mon Nov 26, 2012 2:28 pm

I want the randomly picked object (from the array pool we dealt with before),to be checked for global variable trues,I am assuming a loop would do this,but it would have to carry on checking if it does,or does not find a true comparison.

I just can't seem to work out how this is done....
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Tue Nov 27, 2012 12:00 am

Hmm, still not quite sure what you're trying to do here, but it sounds like you'll want to use your conditions to select all objects that meat the true values, and then use the condition "pick object at random" to select one from that pool of objects.

Is that close to what you'd like to do?
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest