Help with pick nth instance (Failing)

0 favourites
  • 2 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hi! I'm a newcomer, have somewhat experience with Construct2. Today I just found an error I can't get rid of.

    The game consist in a turn-based app, where you can eat 1, 2, or 3 strawberries per turn and then CPU makes his turn (doing the same, eating 1, 2 or 3). The end is not scripted yet, since I can't reach it!!

    Everything is just fine until the last strawberries remain. Then, everything hangs.

    There are 20 strawberries, but some of them seem to be "bugged/jammed".

    In order to debug this, I tried calling the strawberries like this:

    • For every one, put its own UID in an array
    • In a textbox, for every UID in the array, append that ID, thus making me able to read them.

    I found that I only could see 10 UIDs, the other were marked as 0.

    I did the same but with IID, I could only see 10 in the textbox, other 10 marked as 0.

    Deleting those instances (strawberries) didn't either work. It just hang again.

    Construct2 does not seems to be able to pick them either (using pick nth instance in my final source)

    Can someone take a look and see what I'm doing wrong?

    Link to my source:

    dropbox.com/sh/55yleg9ljziv40n/O81VDeEOHb

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your 'Counter' mechanism doesn't work. It keeps increasing, and then you are telling the script to pick the Counter instance, but once the Counter value gets over 10, there aren't 10 strawberries to pick from. You need to devise a better mechanism for picking random strawberries to delete. Try: int(random(0,Rock.Count))

    Oh, and the default size of the Array is 10! Increase the number of elements.

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