Overlapping detection only works some of the time

Hi! I've been using Gamesalad a bit now, and I've managed to find a solution for every problem I've had (thanks to already answered questions on these forums) until now. I'm a bit stuck.

Here's the problem. The actor you control, called avatar, normally shoots these blue circle things. Every time one of these blue balls hits a square or enemy, it decrements their life. The square starts off with 5 life, so after 5 shots, it dies and splits into more enemies. This works perfectly.

The actor (avatar) can also pick up powerups to have increased firepower. In the video, when I move over the white square (definitely planning on changing that image :) ), it changes the avatars image and causes him to shoot green circles rapidly for a few seconds. This works as well. The green circles are supposed to deal the same amount of damage as the blue circles, they are just shot more frequently. Oftentimes when the green circles overlap with the red squares, nothing happens. No life decrement, no square splitting, nothing. Occasionally though, usually at longer range, the squares are affected by the green circles. I'm at a loss to why it only works part of the time, while the blue circles seem to work all the time.

Also, the green circles do increase in size and decrease in visibility during their lifetime, until they destroy themselves after a second. Supposed to be a close range firepower thing.

I'm terrible at explaining a lot of things, so here's a video of the issue. I included the behaviors and a preview of the problem.

Video of the Issue

One thing you can't see in the video is that I have a an actor that spawns red squares in the background.

Thanks for the help in advance.

Comments

  • BBEnkBBEnk Member Posts: 1,764

    It's because when the green dots are interpolating to a bigger size there is no collision detection, which is why they work at distance there at full size and no longer changing size.

  • severageseverage Member Posts: 3
    edited December 2014

    Thanks! Is there any way that you know of to make the collision work while the projectile is interpolating?

  • severageseverage Member Posts: 3
    edited December 2014

    @BBEnk said:
    It's because when the green dots are interpolating to a bigger size there is no collision detection, which is why they work at distance there at full size and no longer changing size.

    Actually, I think I may have figured it out. Make a second projectile every time a green one is shot to 'shadow' the green one and act as the overlay projectile, while the green one is just visual. This works partially, except due to interpolate, the green projectile doesn't get destroyed when it collides with something.

    But thanks a lot for the solution.

  • BBEnkBBEnk Member Posts: 1,764

    @BBEnk said:
    It's because when the green dots are interpolating to a bigger size there is no collision detection, which is why they work at distance there at full size and no longer changing size.

    Actually I'm think I'm wrong on this there does seem to be collision detection but it seems to not work on first few actors for some reason in my testing, strange.

  • zweg25zweg25 Member Posts: 738

    You could "cheat" the interpolation, by interpolating an attribute and then doing an every 0 seconds timer changing the actors size to the interpolating attribute. Not the best way to go about it but should work.

  • BBEnkBBEnk Member Posts: 1,764
    edited December 2014

    I think it's a timer issue, it seems in my testing if you spawn the bullet faster then half the speed of the target spawner it will not detect collision.

    for instance if you set bullet spawner at 3 and target spawner at 6 it will work perfect but reverse that and the targets will stop detecting bullets and not destroy.

    greenBullet 1 Target 2 or both at 2 seems to work

    greenBullet 3 Target 6 Works

    greenBullet 6 Target 3 not Working

    greenBullet 4 Target 6 not Working

    greenBullet 3 Target 2 not Working

    greenBullet 2 Target 4 Works

    greenBullet 3 Target 4 not Working

    greenBullet 2 Target 5 Works

    anyway heres my little test file if anyone wants to check it out maybe another bug.

  • BBEnkBBEnk Member Posts: 1,764
    edited December 2014

    OK I think I know whats going on, If you use no timers or spawning, and just lay out the greenBullet and the target on the scene.

    Layer order: this will Work all targets destroyed.

    GreenBullet

    Target

    Target

    Layer order: this doesn't work

    Target

    Target

    GreenBullet

    Layer order: one works

    Target: miss

    greenBullet

    Target: hit

    explains why timers are causing a miss because of layer order when spawned. So simply spawn target in back of Actor, and greenBullet in front of Actor and it all works.

    and this is only a issue if your expanded size if size is not changing then layer order doesn't matter.

    Hey I learned something new today,lol.

Sign In or Register to comment.