Hi,
I’m changing a sprite when there is a collision with a bullet.
The idea is to show another sprite with the same image on fire and, afterwards, return the original sprite to the initial position. If I just change the sprite (visible false and true) and do nothing else, it works perfect. It the logic flows to the initial sprite reposition, the sprite that with the image on fire never gets to be shown. It looks like the speed of the execution flow is so fast that I never get to see the change before the initialization again.
Is there any way to solve this type of things? if I put a delay with a timer it still doesn’t work.
a list of burning sprites and their associated expiration Instants (list of pairs)
a Clock Timer to frequently scan the burning sprite list for expired burns and clean up the ashes
bullet collision logic to add targets to the burning sprite list.
If you are uncomfortable with lists of pairs, you could just keep a list of burning sprites, and add new ones at the end (highest index), and set the Clock Timer servicing that list to cycle slowly, enough seconds to see the burn, and to clean up and remove just item 1 (if not empty check first) each cycle.
Hi ABG,
thank you for your email. This looks like the correct way to do it. Can you point to an example ? I’m an experienced programmer but just new to App Inventor.
Thank you!