Need a "Make Bullet" solution
ck
Member Posts: 224
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
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
Cheers,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
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)
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.
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?
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
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
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.
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
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Prank Call! Prank Call!