Discuss Scratch

  • Discussion Forums
  • » Help with Scripts
  • » How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it. [RSS Feed]
HeaviestClaw
Scratcher
13 posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.



I need help in this Game i made.

i don't know how to make it so my character is hidden behind the rocks when above it.
i don't know how to make it so my character is infront the rocks when under it.

I need some help please, and thank you!!

Last edited by HeaviestClaw (May 14, 2024 16:38:33)

Mr_Happy_boy
Scratcher
1 post

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

Maybe you can make it so when it is touching rock, you go back ? layers

and vice versa for infront?

Last edited by Mr_Happy_boy (May 14, 2024 16:51:16)

tm_robot
Scratcher
34 posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

HeaviestClaw wrote:

I need help in this Game i made.

i don't know how to make it so my character is hidden behind the rocks when above it.
i don't know how to make it so my character is infront the rocks when under it.

I need some help please, and thank you!!
If yvalue of player < yvalue of rock:
go to front layer (or the layer directly in front of the rock.)
else
go to back layer (or the layer directly behind the rock.)
Koamodo975
Scratcher
500+ posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

Maybe create a list named ‘layers’, and have each object update their layer in a different segment of the list and move to that layer. If an object has a lower y-position than another object, then their section of the list is updated to go past that object.

“If a tree falls in the forest, and nobody hears the sound, did it really ever happen at all?
Did it really ever happen at all…?”
But… what about the bugs, and birds, and squirrels and rabbits and foxes and…
-Koamodo975, sometime in 2023
Hang around on the forums sometimes, try and make games without getting sidetracked.

HeaviestClaw
Scratcher
13 posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

tm_robot wrote:

If yvalue of player < yvalue of rock:
go to front layer (or the layer directly in front of the rock.)
else
go to back layer (or the layer directly behind the rock.)


Ok. i will try this and i will give you resutls.
HeaviestClaw
Scratcher
13 posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

It did not work. I will just make the rocks be above godzilla default then. thanks for trying
tm_robot
Scratcher
34 posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

HeaviestClaw wrote:

It did not work. I will just make the rocks be above godzilla default then. thanks for trying
Can you re-post the project so I can experiment with the code?
gor-dee
Scratcher
1000+ posts

How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it.

  • Discussion Forums
  • » Help with Scripts
  • » How can i make it so if my Character is above something, It will be behind it, But when under of something, IT will be infront of it. [RSS Feed]

Powered by DjangoBB