Discuss Scratch

FarisFawkes
New Scratcher
7 posts

Make enemy shoot

Hello.
I'm working on a scratch project for the CS50x and I'm kinda confused here
I'm making a simple game where the helicopter shoots the Spaceship
The helicopter works perfectly when shooting but the Spaceship doesn't shoot, even tho I put the same code (with the needed tweaks) on both the spaceship and the bullet

The code for the spaceship:
whenclickedforeverpointtowardsHelicopterwaitpickrandom1to3secsbroadcastShoot2

The code for the bullet\missile
whenIreceiveShoot2gotospaceshipshowrepeatuntiltouchingHelicopter?ortouchingEdge?move-10stepshide
drmcw
Scratcher
1000+ posts

Make enemy shoot

In when I receive Shoot2 add
pointindirectiondirectionofspaceship
change move -10 to move 10

probably best to have
broadcastShoot2andwait
otherwise the bullet may be “reset” by a broadcast.

Last edited by drmcw (April 22, 2014 16:56:51)

FarisFawkes
New Scratcher
7 posts

Make enemy shoot

It shoots only 1 time and it's in the opposite direction
drmcw
Scratcher
1000+ posts

Make enemy shoot

Can you share the project?
FarisFawkes
New Scratcher
7 posts

Make enemy shoot

FarisFawkes
New Scratcher
7 posts

Make enemy shoot

I did some adjustments and now it shoots unless I'm under it
Plus the bullet comes out from a wrong place
Any help is appreciated
drmcw
Scratcher
1000+ posts

Make enemy shoot

You need to centre all your costumes. In the costume editor there is a button with a + on it, press that and then move the cross hairs that appear to the correct centre of each costume.
FarisFawkes
New Scratcher
7 posts

Make enemy shoot

Did that and I think it worked, but there's still the shooting problem
Thanks anyway
InnovaMobi
New Scratcher
7 posts

Make enemy shoot

Hello,

New to scratch! Can someone explain how I would go about doing something in an inverted order or backwards.

I have a sprite with like 50 different costumes. To play them one at a time I used the REPEAT puzzle and put 55 in and then inserted the NEXT COSTUME piece and under it the wait puzzle piece. That works fine and it goes through all the costumes properly. How do I reverse it so that when the script finishes, the costumes continue to change seamlessly going from 50 back down to one. Thanks for any and all help!!
drmcw
Scratcher
1000+ posts

Make enemy shoot

FarisFawkes wrote:

Did that and I think it worked, but there's still the shooting problem
Thanks anyway
What is the shooting problem?
drmcw
Scratcher
1000+ posts

Make enemy shoot

InnovaMobi wrote:

Hello,

New to scratch! Can someone explain how I would go about doing something in an inverted order or backwards.

I have a sprite with like 50 different costumes. To play them one at a time I used the REPEAT puzzle and put 55 in and then inserted the NEXT COSTUME piece and under it the wait puzzle piece. That works fine and it goes through all the costumes properly. How do I reverse it so that when the script finishes, the costumes continue to change seamlessly going from 50 back down to one. Thanks for any and all help!!
You should really start a new topic.
Replace next costume with
switchcostumetocostume#-1
FarisFawkes
New Scratcher
7 posts

Make enemy shoot

drmcw wrote:

FarisFawkes wrote:

Did that and I think it worked, but there's still the shooting problem
Thanks anyway
What is the shooting problem?

The spaceship doesn't shoot, you asked me to share my project and I did
But anyways I have a new plan for this thing and I simply want the space ship to hide when it gets hit
I made an if statement and put the hide script and all, but it doesn't work
This is the project:scratch.mit.edu/projects/21036731
I really would appreciate the help cause I'm already WAY behind scheduled and I doubt I'd make it to the end before the dead lines
drmcw
Scratcher
1000+ posts

Make enemy shoot

It doesn't shoot because you've removed all the broadcast and recieve Shoot2 scripts that were discussed earlier!
drmcw
Scratcher
1000+ posts

Make enemy shoot

Best place to do the hit detection is in the bullet sprite. When it detects a ship hit then use broadcast to hide the ship.
InnovaMobi
New Scratcher
7 posts

Make enemy shoot

I realized I posted in wrong place and did make new topic :-) thanks!!
and thank you sooo much for the help!!
meowmoo
Scratcher
500+ posts

Make enemy shoot

heres my shooting AI.
FierceSavitar
Scratcher
26 posts

Make enemy shoot

This is what I did and it worked
defineattackforevergotoEnemyshowwait0.5secsrepeatuntiltouchingPlayer?ortouchingedge?changeyby-10hide

Last edited by FierceSavitar (May 5, 2017 20:12:24)

TheDabber858
Scratcher
8 posts

Make enemy shoot

It's not working for me
goomba5791
Scratcher
2 posts

Make enemy shoot

hello guys i am wondering why my sprite keeps on shooting and when i change it a little it shoots once then done

Powered by DjangoBB