Problem with "Pick nth Instance" (Snake Example)

Get help using Construct 2

Post » Mon Feb 04, 2013 7:28 pm

Hi guys

I made a little Snake game and have some trouble with "pick nth instance"...

I added comments to every important thing, but just ask if something isn't clear.

Snake.capx

I really don't get it why it doesn't work, hope you can help me :)
B
20
S
2
G
2
Posts: 34
Reputation: 2,525

Post » Tue Feb 05, 2013 8:37 am

Your problem is in the way you pick the objects, 'pick Nth instance' selects from pool of currently picked objects and as you are running it inside for loop, there is only one selected by default.

Here is one way to do it, simplified your solution a bit:

Snake demo
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Tue Feb 05, 2013 5:28 pm

Wow thanks alot, works fine!
And its indeed a bit simpler then mine :)

I'm sorry but I still don't get it why my version didn't work :/



This is what I did...

For each (snakebody) <--ordered backwards like I did
{
if(snakebody.number = 0) <-- the one behind the head
{
   Pick(Instance 0 from snakehead) <--- is the last instance from snakebodys
}
else
{
   Pick(Actual loop instance) <--- this should be the looped instance, doesnt it?

   Pick(Actual loop instance -1) <--- instance in front of the looped one, right?
}
}

Maybe I unterstood something wrong with Picking Instances?


EDIT:
Oh now I got it :D
I just tried to pick an instance from an instance, sorry :S
Geru2013-02-05 17:30:23
B
20
S
2
G
2
Posts: 34
Reputation: 2,525

Post » Mon Aug 05, 2013 2:09 am

What do i need to change to make the spawn/loop point linked to a image point or just behind the head?
B
5
Posts: 17
Reputation: 288


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, badmoodtaylor, Yahoo [Bot] and 15 guests