Discuss Scratch

BlueberryMuffin16
New Scratcher
4 posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.


How do I: Kill Enemies, Get Killed By Enemies, and Keep Score? I'm working on a game here:Your text to link here…
LionB2
New Scratcher
4 posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

This is a very common mistake - you have to putthe block that says “When (Green flag) Pressed” on every script. If you don't do this, you'll have nothing to sctivate the scripts with. Another thing you need is the block sorrounding every script, if not they'll only be activated the moment the green flag is pressed, and then dectivated in less than a millisecond.

Do you understand? Just post and tell me if you need more help!
BlueberryMuffin16
New Scratcher
4 posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

To LionB2, Thanks! I get it. So, if you can go to that link I posted, (my game) and remix it or reply to this post, that would be great! I'll put you in the credits for the game once I finish it.
zillarx
New Scratcher
1 post

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

I remixed your game. The scripts I added to the player's sprite should make it easier to move. Also, you might wanna say that for every one enemy killed, it creates a clone of itself so the game keeps going.
deck26
Scratcher
1000+ posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

LionB2 wrote:

This is a very common mistake - you have to putthe block that says “When (Green flag) Pressed” on every script. If you don't do this, you'll have nothing to sctivate the scripts with. Another thing you need is the block sorrounding every script, if not they'll only be activated the moment the green flag is pressed, and then dectivated in less than a millisecond.

Do you understand? Just post and tell me if you need more help!
This is not best practice - if any script is running before the variables it needs have been set the results are unpredictable. That's the most common cause of projects needing the green flag to be clicked twice.

Much better is to restrict most green flag scripts to do no more than set a costume/position for a sprite and tell it to show/hide. Then have one main green flag script

whenclickedbroadcastinitialiseandwait do all initialisations in scripts triggered by thisbroadcaststart
ninjianimation
Scratcher
1 post

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

yeah i looked inside and maybe instead of move 10 steps do this

when key pressed
change x by ()
MTM828
Scratcher
500+ posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

There should be a
change scoreby1
if an alien dies, that solves the score thing. And reset it if the flag is clicked.
whenclickedsetscoreto0
To be honest you should of used clones, using sprites is quite a bad idea, but you seem like you're new so you're unfamiliar with a lot of concepts of Scratch, but to be honest you didn't specify what you want, it's your project so I can't imagine how you'd like the aliens to attack. And that solves everything you asked for, except the spaceship dying part, tell us how you'd like it to be.

Last edited by MTM828 (Sept. 20, 2020 14:57:02)

deck26
Scratcher
1000+ posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

MTM828 wrote:

There should be a
change scoreby1
if an alien dies, that solves the score thing. And reset it if the flag is clicked.
whenclickedsetscoreto0
To be honest you should of used clones, using sprites is quite a bad idea, but you seem like you're new so you're unfamiliar with a lot of concepts of Scratch, but to be honest you didn't specify what you want, it's your project so I can't imagine how you'd like the aliens to attack. And that solves everything you asked for, except the spaceship dying part, tell us how you'd like it to be.
Please check the date before responding. The original question is from 2013 and I don't think clones even existed then.
MTM828
Scratcher
500+ posts

Shooting, Killing Enemies, Getting Killed By Enemies, and Score.

deck26 wrote:

MTM828 wrote:

There should be a
change scoreby1
if an alien dies, that solves the score thing. And reset it if the flag is clicked.
whenclickedsetscoreto0
To be honest you should of used clones, using sprites is quite a bad idea, but you seem like you're new so you're unfamiliar with a lot of concepts of Scratch, but to be honest you didn't specify what you want, it's your project so I can't imagine how you'd like the aliens to attack. And that solves everything you asked for, except the spaceship dying part, tell us how you'd like it to be.
Please check the date before responding. The original question is from 2013 and I don't think clones even existed then.
eer.. er.. but ninjaanimation posted then i saw it then.. sorry! but i saw ninjaanimation post so it was on the top of the help with scripts page, so i thought its new.

Last edited by MTM828 (Sept. 20, 2020 17:06:27)

Powered by DjangoBB