How about the bullets in the project for blue and red balls randomly switching firing, I’ve tried several ways and they all seem to fail!
Changing an animation only changes the images for the sprite.
“bullet_change” is not a sprite, it’s an object group. Obejct groups don’t have animations, they have members which have animations if they are sprites.
This event:
only changes the animation of each bullet_change. It doesn’t change the sprite from NewSprite3 to NewSprite2 (BTW, I’d strongly suggest you give your sprites better names - it makes understanding and identifying the objects a lot simpler).
If you want to change the animation for the most recently fired bullet, you’ll have to:
- modify NewSprite2 to have 2 animations - one for the red ball, the other for the blue ball.
- add a boolean variable (named “
has_fired
”) to NewSprite2 - Change the
Fire
action to “Fire NewSprite2
”. - add another event:
conditions:
-NewSprite has just fired
-variable has_fired NewSprite2 is false
actions:
-change animation of NewSprite2 to Random(2)
-set the variable has_fired of NewSprite2 to true
1 Like
YES, MrMen,let me honour you as my esteemed teacher, you always give me simple and effective pointers, I solved the bullet random problem, and at the same time, found some differences between Random(2) and Random(0,1), Random(2) makes the red ball appear more often, compared to Random(0,1), the red ball and the basketball appear in balanced proportions.