Overlapping objects

0 favourites
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Oy lads!

    Hopefully you are having great weekend.

    I'm just looking for some help with my code. It's about overlaping of objects and unfortunatully, it does not work as I wanted. Well, it doeas not work at all by the way I want it

    Those "squares" on that gear have Instance Variable setted with the numbers form 0 to 360. (6x60) And all I want is - Rotate the gear, overlap the "gear Arrow" and set layer with the value visible. Any ideas how to improve this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks interesting, but I don't understand how it's supposed to work from the picture.

    Why are you testing collision with the Console_Gear (big circle?) and not with the gear arrow (triangle thingy)?

    Could you share the CAPX file?

  • Ey Dop. Well, there is a condition pointing to the animation name "Gear_Arrow". So Collision should be OK for me.

  • What about the CAPX file, can you upload it?

    You can remove all unrelated things from it.

  • Here you go.

  • Looks like you have the same problem as the guy in this post.

    When you first check collision with Console_Gear, the system picks 1 instance of Console_Gear (first available as there are multiple collisions). And then when you trying to check if this 1 instance is playing "arrow" animation, this condition obviously fails.

    You need to change your code to this:

    On an unrelated note - why are you using one object Console_Gear with 4 completely different animations? And why do you distinguish them by animation name (which, by the way, requires special plugin)? This is so weird..

    Wouldn't it be easier to have different objects - Console_Body, Console_Gear_Inner, Console_Gear_Outer, Console_Arrow? Or at least use instance variables?

  • It would be too many objects in the project so I decided to use animations instead of it.

    Ok, I'm going to check that code and will fix it asap. And that special plugin you mean what exactly? We use one behavior - AnimationList but only for the planets in the game. I already have a lot of plugins and behaviors in my C2 so I'm not sure what you are talking about exactly. But thank you so much!

  • Well. I changed the code as you showed me here and it didn't worked as it should. :/ Weird. I also added few sprites to each layer for check. Nothing.

  • Yes, I meant that AnimationList behavior, I had to install it to be able to open your project. But I was wrong, it's not required to test which animation is playing.

    Anyway, you shouldn't worry about having too many objects. I would definitely make your Console with 4 separate objects and maybe combine them into family. This should make many things easier and you wouldn't have this issue with overlapping.

    Well. I changed the code as you showed me here and it didn't worked as it should. :/ Weird. I also added few sprites to each layer for check. Nothing.

    Could you share your new file? And I'm guessing last time when you prepared the CAPX, you removed the code where you pin squares to gears. Don't remove it this time, so I could test properly

  • Sorry buddy. Few mins and it's here

  • Here you go buddy

  • I tried your file and it does work.

    You don't see any changes on the screen because your Menu_XXX layers are visible by default.

    Try making them invisible, and you'll notice how they become visible one by one as you are turning the gears.

    Also, instead of checking for collision, try overlapping - it may work better for you.

    I tested this and it works:

    You also need to change your collision polygon for the arrow frame from square to triangle, for better precision.

  • I did it as you showed me and yeah, it worked. Then I remember how to make it more "easier" thru the functions. Well, right now it looks like this:


    Well, it work for 50% now and I have to find the problem in the code It shows the layers but when I want to choose another layer, the previous one is not "closed".... :/ Dunno why.

  • Download this file, hopefully it does what you need:

    https://www.dropbox.com/s/9bl2g1jud7mex ... .capx?dl=0

    And seriously, get rid of all "Is animation playing" checks and use instance variables instead.

  • Well, problem is solved, thanks to you buddy! Cheers.

    And why you are so annoyed of those "is animation playing"?

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