Double Question

Hey guys,

  1. I said this on another post, but no one answered. How do I make a 2d portal system?
  2. How can I make a shadow for my character? I tried adding a low opacity black to the Sprite, but it didn’t work.
    Thanks

Take a deep breath and…

1, Create two sprites for the two portals
-portal in
-portal out

When player is in collision with portal in, change it position to portal out
Simple as that.

If you want smooth transition as you walk through, you need to make the portal sprites from at least two pieces
-portal in 1
-portal in 2
-portal out 1
-portal out 2

And you going to need two player character sprites

As the player move in to the portal you want to hide the part of the player that is inside the portal and as you move out on the other side you want to show the part that is outside the portal. You can achieve this by changing the Z order of the portal pieces and the player.
So imagine a sandwich, two slice of bread is the two piece of the portal and the cheese between bread is the character.
Now imagine two sandwiches with two slice of cheese. As you move one slice in between the two, pull the other slice from between the other two and this way make the smooth transition effect between the two sandwiches as the cheese would move from one to the other.

2, You are on the right track, you need to use transparent sprites that move and animate along with your character, by making it transparent it will look like a shadow. I have no idea why it didn’t work for you if you share more detail, I and others can give you more detailed answer.

Your questions are a bit vague so it’s hard to know what you want to do, never mind think up a way to do it.

When you say 2D portal system, do you mean how can you teleport an object from one part of a map to another?

What sort of character needs a shadow? A side-scrolling platform character casting a shadow on the floor? A character casting a shadow on the wall? An overhead view where the shadow is off to the side?

Most of the time it should just be a case of creating an object that has a plain black sprite with 50% opacity and positioning that on, under, or to the side of the object casting the shadow using the “Position of an object” action.

Thank you!
I understand how portals work, but thank you for the sandwich analogy :slight_smile:
What I planned on doing was making a diagonal line going up from left to right, that had 50 or so percent of opacity. However, when I applied the sprite to the game, it wouldn’t follow the character.
For the portal thing, is there a way where I could put an On Collision command, and apply the z order (I’m not quite sure what that is :confused: ) If there’s not, that’s okay!

Check the photo for reference

Of course you can, this is the real power of GDevelop you can combine any condition and action to get the result you want. There are no restrictions and limitations.
So you can use the condition to check collision between two objects and simply apply the action to change Z order of an object and it will.

Even though it a 2D engine there are 3 axis in the game space.
X which is the width
Y which is the height
Z which is the depth.

By changing the value of X and Y you can change the position of an object on the screen and by changing the value of the Z order of an object you can basically control what is behind the object and what is in front the object.

So in this case the blue background could be Z order 0 the shadow is Z order 1 and the white logo is Z order 2

If the Portals are pre-set or creatable, how would I find the coordinates to get the character to teleport?

When you set the X,Y position of an object, for position you can use the expression teleport.X() and teleport.Y() and it is going to get the X and Y position of the object called “teleport” for example.

There is a button next to each field, if you click that it brings up the expression editor so you don’t need to type all this from your head if you don’t know, you can use the editor and the tutorials on the wiki to get started :slight_smile: