Problem with "Pick nth Instance" (Snake Example)

0 favourites
  • 4 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • 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.


    I really don't get it why it doesn't work, hope you can help me :)

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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




       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?


    Oh now I got it :D

    I just tried to pick an instance from an instance, sorry :S

  • What do i need to change to make the spawn/loop point linked to a image point or just behind the head?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)