Discuss Scratch

HappyFuzzyKitty
Scratcher
16 posts

Lava Help?

I can't figure out why, but a simple

iftouchingcolor?thengotox:y:0

doesn't always work for lava. Sometimes, like when the player approaches from the bottom, they pass straight through it and I can't find a way to make it stop doing that.
ErnieParke
Scratcher
1000+ posts

Lava Help?

It would be really nice if we can see more of that script. Maybe you can share your project, or post screenshot(s) of the code? Also, are you sure that all of the lava is the same color?

Asking,

ErnieParke
HappyFuzzyKitty
Scratcher
16 posts

Lava Help?

The project is Podball's Mission (https://scratch.mit.edu/projects/70355268/), and I am pretty sure all of the lava is the same color. It is already shared.
footsocktoe
Scratcher
1000+ posts

Lava Help?

HappyFuzzyKitty wrote:

I can't figure out why, but a simple

iftouchingcolor?thengotox:y:0

doesn't always work for lava. Sometimes, like when the player approaches from the bottom, they pass straight through it and I can't find a way to make it stop doing that.

You have that IF block inside another IF block, which is the same as saying ONLY IF BOTH A AND B are true. In your case, the sprite would have to be touching BOTH red and white. Just touching red would not be enough.
ErnieParke
Scratcher
1000+ posts

Lava Help?

Adding onto what @footsocktoe said, this problem is affecting both your lava script and your player death script:



Pointing out,

ErnieParke
HappyFuzzyKitty
Scratcher
16 posts

Lava Help?

So if I take the scripts out of the white then it might work….?
footsocktoe
Scratcher
1000+ posts

Lava Help?

HappyFuzzyKitty wrote:

So if I take the scripts out of the white then it might work….?

I don't know what will work, but be sure you think carefully about exactly what you want Scratch to do. Sometimes it's difficult to figure out the logic of what seems like should be a simple task, but with a computer everything has to be perfect.
sensei1007
Scratcher
14 posts

Lava Help?

whenclickedforeveriftouchinglava?thengotox:0y:0


(you will need to add a sprite called lava)

Last edited by sensei1007 (Feb. 19, 2016 16:57:46)

HappyFuzzyKitty
Scratcher
16 posts

Lava Help?

Okay, now it works right.

Powered by DjangoBB