multiple instances of one object - problem

0 favourites
  • 9 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey Everybody,

    I've got a probleem in my game that i can't figure out how to solve.

    So I'm hoping that some of you could help me.

    when something in my game is overlapping one switch it gets frame 1

    and if not it has frame 0.

    That works for one instance but if I've got more its causing problems.

    after all were pressed at the same time, the frame just jumps back to 0 again when all aren't pressed any longer.

    here's the code example -i hope it helps.

    dropbox.com/s/320mu0amfaeac62/code.PNG

    please help me i just can't find out what the problem is.

    <img src="smileys/smiley18.gif" border="0" align="middle" />

  • is there anyone that could help me ?

  • i edited my post to make it simpler to understand.

    please help !!

  • cannikon

    I couldn't access the picture (dropbox issue it seems), but maybe, you should compare if the switch is overlapping instead the object instead of comparing if the object is overlapping the switch

    Also, what did you mean by :

    "after all were pressed at the same time, the frame just jumps back to 0 again when all aren't pressed any longer."?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • at first thanks a lot for the answer.

    Unfortunately changing the overlapping like you said didn't help.

    With the "after all were pressed at the same time, the frame just jumps back to 0 again when all aren't pressed any longer." i tried to describe the following issue:

    If i just press one switch (by overlapping it) everything works fine (it changes the frames from "pressed" to "unpressed" just as it should.

    When other switches get pressed while one is already pressed they all change their frames to "pressed" (so far so good), but when one of them then isn't pressed any longer, while one or more others are still pressed, it doesn't change its frame back to "unpressed".

    Just when all switches aren't pressed any longer, they all change their frame back to "unpressed" at once.

    i hope it helps <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Maybe if you use an instance variable, a boolean, which will describe if the button is pressed or not, and with the value, change the position of the switch

  • thanks again but sadly this also did not work :(

    i have just fast created a new capx with just this problem to show and make it clear.

    dropbox.com/s/elyevl9rhg1kt7j/test.capx

    hopefully now a solution will be found

    thanks forward

  • Well event 2 will only set the frame back to 0 if event 1 is false - that is there's nothing overlapping any switch. Change the condition in event 2 to:

    Sprite3 NOT overlapping Sprite2

    AND

    Sprite3 NOT overlapping Sprite5

    spriteOverlap.capx

  • Pretty obvious but i just didn't come to that idea.

    Thanks a lot to both of you

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