Discuss Scratch

Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

I'm having trouble making my enemies stop shooting after they die
how could I make them stop with this command?
whenclicked
forevergotoshowrepeatuntiltouchingcolor?changexby-8hidewait2.3secsgotoshowrepeatuntiltouchingcolor?changexby8hidewait2.3secs

I have the enemy and the bullet for the enemy. The command above is for the bullet
This is the command the enemy has
whenclickedshowforeveriftouchingcolor?thenhide

Any suggestions?
deck26
Scratcher
1000+ posts

How to make enemies stop shooting after they die

You could have a variable ‘enemy-dead’ set to 0 initially and set to 1 when the enemy dies. The bullet sprite checks the value of the variable before shooting if not dead.
Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

Could you show the command?
guff1232
Scratcher
33 posts

How to make enemies stop shooting after they die

Try this:

whenclickedforeveriftouchingcolor?thenbroadcast stop bullethide
Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

In the enemy or the bullet? Because if it's in the enemy then it's not working
deck26
Scratcher
1000+ posts

How to make enemies stop shooting after they die

It would be easier to see the project. I'm not clear why the bullet seems to be going in both directions.
Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

In my game all the enemies are stationary but there are two that look side to side and that is the command for one of those side to side ones.
I also made it on the offline version but i'll quickly try to make the enemy on this version.

Last edited by Freilly12 (June 7, 2015 16:48:27)

deck26
Scratcher
1000+ posts

How to make enemies stop shooting after they die

OK it sounds like what you need is
whenclickedrepeatuntilenemy-dead=1gotoshowrepeatuntiltouchingcolor?changexby-8hidewait2.3secsgotoifenemy-dead=0 thenshowrepeatuntiltouchingcolor?changexby8hidewait2.3secswhenclickedshowsetenemy-deadto0repeatuntilenemy-dead=1iftouchingcolor?thenhidesetenemy-deadto 1


Last edited by deck26 (June 7, 2015 16:55:47)

Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

Ok i'll try that
Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

it's not working.
Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

Here's a link to the game (only testing)

Your text to link here…
deck26
Scratcher
1000+ posts

How to make enemies stop shooting after they die

Works OK for me. I added a ‘wait (1) secs’ in the bullet script (before the main repeat until) to ensure that the other script had time to set ‘enemy-dead’ to 0.

Here's my remix - https://scratch.mit.edu/projects/66068776/ - let me know when I can delete it.
Freilly12
New Scratcher
10 posts

How to make enemies stop shooting after they die

Thanks!

You can delete it now
ninjo99
Scratcher
2 posts

How to make enemies stop shooting after they die

I am having a similar problem with my star wars galaga game, only one tie fighter is shooting and it is not appearing soo you cant kill it and it just keeps on shooting. The game is not fully developed yet, but I need help with some minor things first. Please Help me fix it, here is a link.

https://scratch.mit.edu/projects/137639790/
deck26
Scratcher
1000+ posts

How to make enemies stop shooting after they die

ninjo99 wrote:

I am having a similar problem with my star wars galaga game, only one tie fighter is shooting and it is not appearing soo you cant kill it and it just keeps on shooting. The game is not fully developed yet, but I need help with some minor things first. Please Help me fix it, here is a link.

https://scratch.mit.edu/projects/137639790/
Please start your own topic rather than necroposting.
PizzaAddict4Life
Scratcher
1000+ posts

How to make enemies stop shooting after they die

Dotun333 wrote:

whenclickedifthentouching?endstop

If you want to test out scratchblocks, go to the official scratchblock testing topic please.

Powered by DjangoBB