Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » If statement not working?
- PaoAndreCM
-
Scratcher
9 posts
If statement not working?
Hello everyone,
I'm new to scratch and I'm trying to animate an eagle and a snake. I want the snake to move forward, minding its own life and changing costumes, until the eagle flies down to it and catches it. I want the eagle to fly down to the snake, catch it, and fly up with it. I want the snake to change to a costumes where it looks paralyzed (snake-b) once the eagle catches and flies up with it.
I've managed to give the illusion that the eagle flies down to the snake, catches it and then flies up with it. However, I haven't been able to make the snake change to the costume snake-b once the eagle catches it. I have an if block that if the snake is touching the eagle, it should switch to costume snake-b. But it doesn't seem to be working. What am I doing wrong?
I would also like to make the eagle catch the snake more seamlessly. The eagle seems to bounce of the snake for a bit before it manages to take it with it.
Here's the link to my project if you want to take a look https://scratch.mit.edu/projects/291521502/
Thank you in advance!
I'm new to scratch and I'm trying to animate an eagle and a snake. I want the snake to move forward, minding its own life and changing costumes, until the eagle flies down to it and catches it. I want the eagle to fly down to the snake, catch it, and fly up with it. I want the snake to change to a costumes where it looks paralyzed (snake-b) once the eagle catches and flies up with it.
I've managed to give the illusion that the eagle flies down to the snake, catches it and then flies up with it. However, I haven't been able to make the snake change to the costume snake-b once the eagle catches it. I have an if block that if the snake is touching the eagle, it should switch to costume snake-b. But it doesn't seem to be working. What am I doing wrong?
I would also like to make the eagle catch the snake more seamlessly. The eagle seems to bounce of the snake for a bit before it manages to take it with it.
Here's the link to my project if you want to take a look https://scratch.mit.edu/projects/291521502/
Thank you in advance!
Last edited by PaoAndreCM (March 9, 2019 01:38:14)
- Kraken_Games
-
Scratcher
100+ posts
If statement not working?
Have you put it in a forever block?
If you haven't, it only checks if it's touching the eagle for one frame after the flag is clicked.
Haven't looked at project because I don't have time, sry.
Tell me if this works
If you haven't, it only checks if it's touching the eagle for one frame after the flag is clicked.
Haven't looked at project because I don't have time, sry.
Tell me if this works
- deck26
-
Scratcher
1000+ posts
If statement not working?
What you have is a script that repeats until the snake is touching the eagle and it changes between the two costumes. Once it touches the eagle that script is done and doesn't do anything else. If you have an if/else Scratch will only run one set of code or the other. If you want it to run the other set of blocks you either need to have a loop around the if/else but if you know you start with not touching just do
repeat until touching eagle
change costume
wait
end
whatever you want to happen next
repeat until touching eagle
change costume
wait
end
whatever you want to happen next
- scratchexpertise
-
Scratcher
1 post
If statement not working?
Hello everyone,hi poaandrecm] the mistake you make is that you dont put a forever loop over the if then statement
I'm new to scratch and I'm trying to animate an eagle and a snake. I want the snake to move forward, minding its own life and changing costumes, until the eagle flies down to it and catches it. I want the eagle to fly down to the snake, catch it, and fly up with it. I want the snake to change to a costumes where it looks paralyzed (snake-b) once the eagle catches and flies up with it.
I've managed to give the illusion that the eagle flies down to the snake, catches it and then flies up with it. However, I haven't been able to make the snake change to the costume snake-b once the eagle catches it. I have an if block that if the snake is touching the eagle, it should switch to costume snake-b. But it doesn't seem to be working. What am I doing wrong?
I would also like to make the eagle catch the snake more seamlessly. The eagle seems to bounce of the snake for a bit before it manages to take it with it.
Here's the link to my project if you want to take a look https://scratch.mit.edu/projects/291521502/
Thank you in advance!
put a forever loop over it every time you use if then
- GibberishGibberfish
-
Scratcher
2 posts
If statement not working?
Hello, my name is Gibberish, im a new scratcher and i need help with a coding error that i cant find. its supposed to make the office in my game move depending on where the mouse is, does anybody hav e a solution?
- deck26
-
Scratcher
1000+ posts
If statement not working?
Hello, my name is Gibberish, im a new scratcher and i need help with a coding error that i cant find. its supposed to make the office in my game move depending on where the mouse is, does anybody hav e a solution?Create your own new topic please rather than posting on an old one. Also a good idea to share the project when asking for help.
- krrishhp
-
Scratcher
2 posts
If statement not working?
do any of you use scratch module 2 rpif . need help on clone wars . use forever loop still not working .
- deck26
-
Scratcher
1000+ posts
If statement not working?
do any of you use scratch module 2 rpif . need help on clone wars . use forever loop still not working .Please create your own new topic.
- -BestPlayer-
-
Scratcher
1 post
If statement not working?
Im trying to code a echo show 8 in scratch and my if statment won't work help please
.
.
- kfchikinfiter
-
Scratcher
100+ posts
If statement not working?
Im trying to code a echo show 8 in scratch and my if statment won't work help pleaseplease don't comment on old topics, create a new one instead
.
- medians
-
Scratcher
1000+ posts
If statement not working?
Im trying to code a echo show 8 in scratch and my if statment won't work help pleasePlease make a new topic for this with the link to the project (make sure that it is shared or we can’t access it to help you). This was last posted on in 2021.
.
- Discussion Forums
- » Help with Scripts
-
» If statement not working?










