instant destroy problem

CoIinCoIin Member Posts: 197
edited November -1 in Tech Support
Could you all look at this?:

http://gamesalad.com/game/play/29588

It's made with 0.6.1, so may not work unless you've updated your plugin.

Clicking on the background causes a white square to be spawned where you clicked. Clicking on the white square will destroy that square. In this case I'm using touches.

The test file shows two problems. One is that when you click to destroy a square, a new one is immediately spawned, because the background also got the click (or touch). Is there a way to have something only happen if the actor clicked on was the most forward one?

The other problem is that after clicking one square to destroy it, from then on any that you try to spawn immediately get destroyed.

In my real project I'm doing lots of attempts to solve this problem already, such as having a "dead" attribute, and also having a boolean set by a timer, so that the background won't attempt to spawn a new actor during the time that an actor is being destroyed, and an actor won't attempt to destroy itself right after being spawned. Those don't solve the problems.

So, sticking with the very simple example, how might I fix the two issues?

Comments

  • Fafnir312Fafnir312 Member Posts: 161
    I downloaded your project and got it working.
    Here's it is:
    http://gamesalad.com/game/play/29672
  • CoIinCoIin Member Posts: 197
    Thanks for trying, but unfortunately even with some of the workarounds you've done, that are similar to ones I've tried, your one also fails. At least it answers a question about whether the problem is only happening with touch inside of mouse.

    Using touch is more likely to go wrong, but with your own example, try this:

    Click to make a square, click to make it go away again. Do that as many times as you like, it should still be working (especially if you're using a trackpad).

    Now click to make one, but when you click to get rid of it, do a slight drag of it first. That simulates what a touch does, and can also happen if you are using a mouse too quickly.

    From then on, yours show the same problem my one does.
  • CoIinCoIin Member Posts: 197
    No, it's not. Each time you click you remove the old one ok, but you also create a new one. I only want to either create one or remove one.
  • Fafnir312Fafnir312 Member Posts: 161
    Wierd. It was working on my computer just fine.

    EDIT: Yes, it works on my computer but not online.

    EDIT: o_O Now it's working fine online... I dunno what's going on. Maybe tshirtbooth will come up with something that works regularly.
  • CoIinCoIin Member Posts: 197
    I make your one fail in Creator as well as in a browser, so hopefully you made a change after you had done the upload.
  • CoIinCoIin Member Posts: 197
    If you're saying that it now works online without you having made a change, then I suspect you're not testing in the right way. To make it very easy to go wrong, click to make one, then drag that one a noticeable distance before releasing the mouse, when it will correctly disappear. Now try making a new one. It won't stick around.
  • Fafnir312Fafnir312 Member Posts: 161
    Oh, you're right. I never tried that :P
  • Fafnir312Fafnir312 Member Posts: 161
    tshirtbooth, click in a square and drag. Then try clicking elsewhere. It still doesn't work. I think there needs to be a check for mouse button up, but I'm not sure where.
  • CoIinCoIin Member Posts: 197
    Thanks for trying to come up with a way, but alas yours fails in the same way that Fafnir312's does. Try exactly the same testing steps, though in your case the square won't actually drag. But after one attempt to drag it, further squares don't stick around.
  • CoIinCoIin Member Posts: 197
    Incidentally, some of your workarounds also look similar to ones I've tried. Using collision to know that the white square is over a green square very nearly works, but sometimes it doesn't, and once it fails it continues to fail.

    Getting a lot more basic about this, is there any way to prevent a click from getting through to layers underneath? For example, if the background plays one sound and the foreground object plays a different sound, would it be possible to only hear the foreground sound when you click on that object?

    If that kind of things was possible, I could use a similar trick here.
  • Fafnir312Fafnir312 Member Posts: 161
    I don't think you can do such a thing with layers at this point.
Sign In or Register to comment.