Top-down game with "3D" jump

Hi everyone!
I’m doing some experiments with Defold. I’ve been always into top-down games since I started game development, so I’m exploring Defold with this “category”. I would like to introduce a sort of jumping system in a top-down game, somehow like in side-scrolling games. I have to simulate a Z axes and of course I’m struggling to get a good result. Maybe should I gave up with this idea? Probably there’s a reason if someone didn’t already introduced it in their games :laughing:
Here what I achieved so far:

As you can see from this short demo I still can’t find a way to handle the shadow when jumping up or down.
What do you think so far? Should I give up with the idea? (I’m worried it’ll bring too many issues) :upside_down_face:

1 Like

Fixing the jump issue is straight forward enough. Place the shadow sprite in a parent game object - which is the true position of the character. The character sprite goes in a child object which you can then move relative to the shadow.

Beyond that, things may get tricky. If you have blocks of different heights the player can jump onto for example, may be problematic.

4 Likes

That’s an idea, but if I do that then the collision won’t move with the go (because I’m just moving the sprite when jumping, creating a sort of “illusion” for the player) and in this way I’m not effectively moving the go so I can’t make the go reach different height or cross ravines (for example). Am I right or I didn’t understand your solution?

You can add your collision shape to the child object so it moves with the player sprite.

Sorry, but I think I’m not following you. I’m new to Defold and maybe I’m not grasping some concepts. Can you show me an example of how you’d structure the player collection? (even just with a text list).
This is how I currently structured mine:
image
player.script contains the player movement (including jump) and collision handling
shadw.script is a script that makes the shadow game object follow the player when the player walks

This was the structure I was thinking of. The shadow sits at the player coordinates and the avatar can be moved independently for the jump animation. Not ideal for every situation but might be the foundation for something more.

image

2 Likes

Hello, I’m making something similar.
My character contains two collider, one for wall / other collision and one for floor detect.
than use script to create character sprite.go and shadow sprite.go, and calculate the real showing offset by floor detect on moving, Z calculation follow script.go.
dfr1
dfr2
but I must say, tilemap look petty complex and tricky.
I haven’t make any video yet, if you looking for any demo, you can go to my itch.io page.

1 Like