Discuss Scratch

Viradan
New to Scratch
9 posts

Actually not sure if it's a bug or programming error

My browser / operating system: Windows NT 10.0, Chrome 63.0.3239.84, Flash 28.0 (release 0)
Very basic command I thought. Programmed for when lives =0 to stop all. But I can still shoot- can't move or anything else, but can still shoot.
Viradan
New to Scratch
9 posts

Actually not sure if it's a bug or programming error

I mean sometimes it deducts 2 lives and other times 1 even though directed to deduct 1 life. Why is it inconsistent? So I guess programmer error also?
SpaceDragon1
New to Scratch
100+ posts

Actually not sure if it's a bug or programming error

It would be helpful if you shared your program so we can see what the error is. It is most likely a problem with your scripts.
You probably have something like:

forever
if <touching color [#acdb29] ?> then //Or touching a sprite
change [lives v] by (-1)
end
end

What is happening is that the bullet (I’m just assuming things about your program) is touching your player, but it takes a second for it to disappear, so the above code triggers multiple times before the bullet disappears.
What you can do is have the sprite wait until not touching that thing:

forever
if <touching color [#acdb29] ?> then //Or touching a sprite
change [lives v] by (-1)
wait until <not <touching color [#acdb29] ?>> //Or sprite
end
end

This will fix both the inconsistancy and the problem of not stopping.
What was happening was that your player was at 1 health, and then the code triggered twice, bringing the health to -1, so it does not stop. To make sure, wha you can do is say:

if <(lives) < [1]> then
stop [all v]
end

If this does not fix the problem, then please share the project and I, or someone else, can take a look at it.
Viradan
New to Scratch
9 posts

Actually not sure if it's a bug or programming error

Thanks for your help but still having problems which like you said probably script errors. I cannot figure out how to share what I have done so far though.
SpaceDragon1
New to Scratch
100+ posts

Actually not sure if it's a bug or programming error

When you go to your project edit mode, there should be a button that leads you to the project page. From there, you can hit the share button, and we can view the project.
Viradan
New to Scratch
9 posts

Actually not sure if it's a bug or programming error

Ok I did that- just thought I could share directly to this thread. Thank you again!
SpaceDragon1
New to Scratch
100+ posts

Actually not sure if it's a bug or programming error

You can link the project here by pressing the linked chains in the text toolbox above where you type. Then copy and past in the URL to the project. It will show up as a link once you post. Unfortunately I am on an iPad, and can not view your project (I can’t wait for Scratch 3.0 which will not use Flash). I am contacting people who may be able to help you.
Viradan
New to Scratch
9 posts

Actually not sure if it's a bug or programming error

solar_sausage
Scratcher
17 posts

Actually not sure if it's a bug or programming error

with me a variable that is only supposed to have numbers in has the letters NaN in it. anyone know what this means?
also, on a variable for hp, it said -inf. how and why is this happening?
SpaceDragon1
New to Scratch
100+ posts

Actually not sure if it's a bug or programming error

solar_sausage wrote:

with me a variable that is only supposed to have numbers in has the letters NaN in it. anyone know what this means?
also, on a variable for hp, it said -inf. how and why is this happening?
Please make your own topic instead of posting here.
solar_sausage
Scratcher
17 posts

Actually not sure if it's a bug or programming error

Viradan wrote:

My browser / operating system: Windows NT 10.0, Chrome 63.0.3239.84, Flash 28.0 (release 0)
Very basic command I thought. Programmed for when lives =0 to stop all. But I can still shoot- can't move or anything else, but can still shoot.
when a message is broadcasted, sprites can revive it and act as normal, even after a stop all script.
stop [ v]
check to make sure this isn't happening!
asivi
Scratcher
1000+ posts

Actually not sure if it's a bug or programming error

Hi.

when [ v] key pressed//this is an event block, it will work even the project is not running
if <(Lives) > [0]> then//if you add this condition it will not create any clone when you run out of lives
create clone of [ v]
end

You be sure of lives are 0 when you save the project.

Powered by DjangoBB

Standard | Mobile