Discuss Scratch

toyuu
Scratcher
66 posts

I need help with layers

I have a problem : I made a survival game but I have a problem with the trees, they function individually so that if the player touches their collision box named “ColisionBox” then they go under the player, but if the player touches the collision box named “ColisionEvent1” they go over the player. The problem is that if one (or more) tree(s) touches another tree then it goes under (or over) the other tree(s) too! Please help me.
(Making sure that no tree touches another is not what I want.)

The code that i'm talking about:
when I start as a clone
show
forever
switch costume to [ColisionBox v]
if <Some conditions> then
PlayerColide
end
switch costume to [ColisionEvent1 v]
if <Some conditions... Again> then
go to front


else
go to back
end
end
Uartar
Scratcher
22 posts

I need help with layers

When the problem occurs, are the trees affected rapidly switching between the two states of going under and going over?
toyuu
Scratcher
66 posts

I need help with layers

Uartar wrote:

When the problem occurs, are the trees affected rapidly switching between the two states of going under and going over?
Yeah, the tree go instantly over the other(s) now with the opacity effect i almost fix it, but now the bug that remain is that some trees are over the others, i will try to fix it but thanks if you help me
Better you see it from yourself (click the green flag until there is two trees one under the other): hhttps://scratch.mit.edu/projects/562610639/

Last edited by toyuu (Aug. 23, 2021 02:47:06)

toyuu
Scratcher
66 posts

I need help with layers

I just found the solution ! i don't need help anymore but thanks.
Vaibhs11
Scratcher
1000+ posts

I need help with layers

Reporting to be closed as resolved.

Powered by DjangoBB