Please help me with this my variable (Score) is not changing when i hit the enemy. Programming: Scatch MIT
link for file https://scratch.mit.edu/projects/840044224
I expect it to change when i hit the enemy with bulet
Please help me with this my variable (Score) is not changing when i hit the enemy. Programming: Scatch MIT
link for file https://scratch.mit.edu/projects/840044224
I expect it to change when i hit the enemy with bulet
The forever
loops that are supposed to increase score, are both under a when green flag clicked
hat block.
That means they only work for the main instance of their sprite; not for clones.
Both the bullets and the enemies are clones; the main instances of the sprites are invisible and do not move.
That means the touching
block will never detect a collision.
One solution is to replace the when green flag clicked
hat block by a when I start as a clone
hat block.
Another possibility is to remove the entire loop, and simply increase the score as you delete the enemy clone.
In the costume 2 sprite, put an if
statement, if the costume 2 touches costume 3, increase the score by 1 as seen here:
You can see a modified version of the game.