Problems with multiple instances of object

0 favourites
  • 11 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hello,

    I'm currently working on a vine level gimmick in my game. Essentially, there is a berry seed thing that when pushed into a pot grows a climbable vine. I got it to work fine, but when I place another instance of it in my level, the second vine will activate when the first one activates. Usually when stuff like this happens the "for each" conditions fixes it, but it isn't working for this. Why doesn't the "for each" work in this case? Am I using it wrong, or do I need to use something else?

    Thanks

    drive.google.com/file/d/1EB4tDaAoHSblTJnMCOw2yMZoSqqp5IVd/view

  • When you signal "Grow" it picks all vines. How I approach this is to give the berry and vine instance variables like ID numbers. Then when the berry is in the place, you pick the vine that matches the ID of the berry and grow it. Another way is to not use wait for signal but call a function with the correct vine's UID and send it through as a parameter to grow that particular vine. However you do it, you need to specify or pick the vine and apply the grow mechanic to that vine.

  • Thanks!

  • I gave it a try. I gave the vines and berries matching ids and then put a condition in the signal event that they had to be equal. I must've done something wrong because they still grow at the same time. I haven't really explored functions yet. I might have to do that.

    Here's the file where I tried to do the matching ids:

    drive.google.com/file/d/1MklZQaPyUyTAcnQwQ__R-swM_WTnQecF/view

  • Give vinecollision the same vineid, and use Timer, which is instance based.

    blackhornettechnologies.com/Construct3Stuff/Samples/VineUpdate_Snalec.zip

  • Thanks!

  • I think the vine saga may be close to an end lol.

    So I got pretty much everything working. The vines grow independently now and animate independently now. The last step is the ladder part of it. Basically I have invisible ladder collision that turns on when the vine finishes animating, but no matter what I do I can't seem to get the ladders to enable independently. If I trigger one vine, all of those individual ladders are enabled too. I've tried using similar techniques as with the other vine aspects but I just can't seem to get it to work.

    I really appreciate you guys helping me out. This is my first time taking a project seriously and while I'm learning a lot there is still lots to learn.

    https://drive.google.com/file/d/1S3J67ieSnXAfZGhIIw2J1FRcatrfeZC2/view?usp=sharing

    To see the problem I'm having, grow the first vine. Then go to the second area, don't push the berry in, but try climbing where the vine should be and you will climb despite the vine not being there.

    Thanks

  • You're overthinking it a little bit, you would just match the ladder ID to the currently growing vine right? So your last event should look like this. Stay away from using 'for each' as well when picking things here since you are only ever trying to enable one object.

    dropbox.com/s/4z94bzgqhv135gu/vine1.jpg

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow I really was overthinking it. Thank you! I feel like I still don't fully understand the for each condition, I feel like it's the thing I try to slap onto events when they don't work right and it sometimes fixes them. So if I understand right, they make it so the event only applies to individual objects and not all the object of a type. So should I not be using for each here because the ids I've assigned are doing ti for me?

    Again, thank you all for the help!

  • It's difficult to describe when you would need it but in general it's better to not use it and pick instances based on your own conditions such as here with the matching IDs. When you get more knowledgeable with Construct you start to see how to use for each to run events once for each instance.

  • Cool. Thank you!

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