Need a "Make Bullet" solution

ckck Member Posts: 224
edited November -1 in Working with GS (Mac)
I have a shooting game with multiple targets on the stage. I'm counting the targets as they're hit. BUT, if the targets are hit in succession too quickly, the count attribute doesn't update for each target. This happens about 20% of the time.

As I understand, this is not an uncommon problem - Corona Game Edition has a makeBullet function to address this. Has anyone found a workaround? Desperate to sort this out.

Thanx CK

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    I don't understand what 'make bullet' does and how it differentiates from what you're doing. Would you mind clarifying that please?

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • ckck Member Posts: 224
    Thanks QS - happy to.

    I've been fighting this count thing for a couple of weeks. Say you have 12 targets on the stage, and you spawn an actor and fire it at them. onCollision, you destroy the target actor and update a global variable for score. The variable update is contained in the bullet actor, not the target actor.

    What I'm getting is that the collision happens, destroying the target actor, but when two or three targets are hit in quick succession, the global variable isn't updated.

    Now, a correction - I was looking at the Corona documentation, and their bullet solution is to solve a problem where my bullet would pass through the target without detecting the collision (because collision is "detected periodically at world timesteps"). Their bullet thing makes collision detection continuous.

    That's not the problem I'm having, as the thing must be detecting the collision (the target actor is destroyed), but it's just not updating the variable every time.

    (edited to correct wordsalad)
  • POMPOM Member Posts: 2,599
    if i understand it right your problem is that when the target is hit, it dosent add +1 to the count?!

    if that is the case it is NOT a common problem for my knowledge,
    maybe something is wrong with your rules, check the logic of things and the order from
    top to bottom (very important)

    basically it should be something like - when collide with bullet
    change count to count + 1

    and it should work, if i did not understand you right so just forget what i said =)
    like QS said, the more info you give, the more help you get

    EDIT : i wrote it the same time you did so now ill read the post above.
  • ckck Member Posts: 224
    Thanks p-o-m. See above.
  • POMPOM Member Posts: 2,599
    @ ck
    check that the "update a global variable for score" rule is above the destroy rule

    p.s how fast is this shooting? i mean how many targets do you shoot at 1 sec?
  • quantumsheepquantumsheep Member Posts: 8,188
    ck said:
    Say you have 12 targets on the stage, and you spawn an actor and fire it at them. onCollision, you destroy the target actor and update a global variable for score. The variable update is contained in the bullet actor, not the target actor.

    I don't understand why you change the variable in the bullet actor?

    Surely it would be a whole lot simpler to update the variable in the target actor itself? That way, every time it's hit, it would update the variable by 1.

    Is there a specific reason the update is done via the bullet?

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • ckck Member Posts: 224
    POM: I moved the behaviours up to the top of the bullet actor - this has improved things considerably. The variable is being updated about 95% of the time now. There are two to three targets hit, per second.

    QS: I did have the change variable in the target. I thought that perhaps the actor was being destroyed before the variable was updated, so I moved it to the bullet.

    Y'all're great, btw.
  • quantumsheepquantumsheep Member Posts: 8,188
    ck said:
    Y'all're great, btw.

    Oh, we know ;)

    I'd move the variable change back to the actor. Make sure you have your score change *before* you put in 'destroy actor'.

    If that doesn't work, put in a tiny timer for destroy - so

    Change score to score +100
    'after .1 seconds' destroy actor

    Hope that helps - good luck with it!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • ckck Member Posts: 224
    Thanks, y'all
  • ckck Member Posts: 224
    No, it was to continuously detect collision, but I think GameSalad already does. I was looking for the wrong answer, I'm afraid.

    Prank Call! Prank Call!
Sign In or Register to comment.