Fill Array with Sprites

Get help using Construct 2

Post » Fri Jun 03, 2016 9:19 am

Hello,

its my first post - and i have to say iam new here. I have watched some tutorials about how to fill arrays, but iam quite not sure how to solve the task i want to do.

I want to place "foodsteps" (sprite images) in an straight order onto my screen. The game mechanic should be, that you have to search them, and if you find one, the next one appears on the screen (right behind).
So you have to follow this foodsteps until you reach the destination place. I Thought to place them into an array and make the opacity of all (exept the first one) to zero. And if you follow the path, each foodstep which comes next will change its opacity to 100.

I hope you can follow me. If not - let me know.

So how would i fill my array with my sprites (basically its only one spirte i use several times via copy paste and placing on the screen unitl i got a big path with X instances of this sprite)

It would be great if someone would have an idea. :)


Usually i use Unity or flash to programm games in C#, Js, or ActionScript3. Its my first experience with an "non programming" engine.

Thanks a lot!
B
8
S
2
Posts: 141
Reputation: 1,002

Post » Fri Jun 03, 2016 9:30 am

@Congrats2u

I don't know if I've correctly understood your question, but I would do in this way:

1. I would create a "for" loop
2. In each iteration I would create the sprite in a given position
3. In each iteration I would put the new UID in the n-th position of the array

When one of the sprite is discovered, I will search for it's position in the array and uncover the next one, knowing the UID.

... but I'm not sure if that is what you need :)
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
30
S
13
G
4
Posts: 141
Reputation: 4,832

Post » Fri Jun 03, 2016 9:38 am

At first - Thanks for your super fast answer. Youre totally right Jeff, that would be the idea.

Could you explain me how to fill an array with the informations (UID)? because i couldnt find a possability to fill them into the array.?

The next thing would be: I have to give them all a collider...or a position detection (plus offset in x and y direction) for detection when the next/following object has to appear on screen. But at first i have to bring the array with my sprites to work :)

Thanks for your support Jeff - if you could give me an example of the array filling term it would be great!

Cheers!
B
8
S
2
Posts: 141
Reputation: 1,002

Post » Fri Jun 03, 2016 10:06 am

@Congrats2u

Sorry, I am at office now, so I cannot prepare a capx example...

The idea however is:

1. Create the loop (you can find ton of tutorials on how to use loops :) )
2. System -> Create object <Footstep sprite>
3. Array -> Set at X [loopindex] <Footstep sprite>.UID


In the late evening/tomorrow I might be able to prepare something if you didn't manage yourself... but try it :)

P.S. use the @ and the user nickname to let them know you've answered :)
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
30
S
13
G
4
Posts: 141
Reputation: 4,832

Post » Fri Jun 03, 2016 11:05 am

@Jeff Skyrunner Youre great! Thanks!

I will try to figure it out.

Each example would be great but dont stress yourself ;)

Cheers!
B
8
S
2
Posts: 141
Reputation: 1,002

Post » Sat Jun 04, 2016 6:50 am

@Congrats2u

This should hepl you starting :)

https://www.dropbox.com/s/zl1mil2mkwi9acl/LoopExample.capx?dl=0
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
30
S
13
G
4
Posts: 141
Reputation: 4,832

Post » Sat Jun 04, 2016 8:30 pm

Not really happy with storing UID's in an array. That way the objects have to exist. And keep on existing. Not flexible.
Therefor:
https://www.dropbox.com/s/68qeajb2ko8c6 ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Jun 05, 2016 7:53 pm

It depends what he needs :)
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
30
S
13
G
4
Posts: 141
Reputation: 4,832

Post » Sun Jun 05, 2016 8:58 pm

That is so true Jeff.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Jun 06, 2016 7:47 am

@Jeff @99Instances2Go really Thank you guys! Nice support! I will try it out today!
B
8
S
2
Posts: 141
Reputation: 1,002

Next

Return to How do I....?

Who is online

Users browsing this forum: blackhornet, tarek2 and 28 guests