Walk behind an object (Layers and 2.5 D Games)

0 favourites
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • What I'm tying to do is build a wall in 2.5 D

    I have the character controlled by 8 direction, and I set the collision box to only the base of the wall. See the image below...

    In Red: What is happening right now (character is on top of the wall image)

    In Green: What I want to happen (character is behind the wall image)

    In Black: Wall

    In Blue: Wall Base (the collision part)

    <img src="http://renegew.com/wall.png" border="0" />

    How do I fix this?

  • Hi JoshWegener,

    You could put the red and green characters on different layers (1 above the wall layer and one below). That way the green sprites would always look as if they are walking behind the wall.

    Hope that helps you!

    <img src="smileys/smiley1.gif" border="0" align="middle" />

    Edit - Sorry, think I may have misread the post! But if you are looking for a way to make your sprites walk behind the wall the same advice applies. Just make sure that you spawn your sprites on a layer which is below the wall layer!

  • I?m not sure where your problem is, I try to explain you what I would do.

    Black Z-index = 1

    Blue Z-index = 2

    Green Z-Index = 3

    //Can also be done with Layers

    Blue = Platform

    + Green is overlaping Black

    + trigger once

    ++ Green is overlaping Ground(I Hope you have an image for the ground)

    ---> Set Green Z-Index behind Black or one Layer behind Black

  • I updated my images... The RED is what is currently happening (and I don't want that)... Green is what I want to happen...

    <img src="http://renegew.com/wall2.png" border="0" />

  • Darklinki the entire black/blue is the wall... the blue part is just collision box.

    Currently, it's all on the same layer.

  • So the player cant move on the blue part ? So you just want to let him move behind and in front og the Black wall ?

  • Darklinki Correct

    In this game I'm working on, there will be lots of objects like this... that the player can walk behind or in front of.

  • I had the same problem in a game I'm working on. Just install rexrainbow's Z-Sorter Plugin and use that.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Without any plugin just check the Y of the sprites, send the spite to top or bottom of layout.

    For example you could add every object in a family and do :

    For each (ordered) Family order by Family.Y -> Family Move to top of the layer.

  • Zephlon Could you link me to the plugin page (not just the zip)?

    Joskin Thanks! (I can't do families in the free version... thinking about buying today...) Just trying to make sure that this application can handle my game...

  • This is much easier with layers create two more layers, set your black wall to layer 1, the blue to layer 2 and your done, then changing your player from layer 0 (farthest from camera) to layer 2 send to top (nearest) when needed will mean any other objects added in future can just be placed on the correct layer without needing constant overlap checks

  • pixel perfick Correct me if I'm wrong, but I don't think that will work, and here is why:

    if you have 4 layers

    0 background

    1 <Place Holder>

    2 Black Wall

    3 Blue (collision) (and player)

    The player will always be in-front of the wall... I would need to move the player to layer 1 in order to make him go behind the wall... see what I mean?

  • There are multiple ways to do this. the easiest way is to either send the sprite to the bottom of the layer or sent the sprite to another layer. Sprite: compare y - if above collision object - sent to layer 1 or sent to bottom of layer. These actions are at the bottom of the sprite possibilities. Z order.

  • Yes you would have to move the player to layer 1, but I don't see why that is an issue...

    If your sure it won't work, I'm sure I don't know exactly what it is your trying to do, moving between the layers is just the same as moving up and down the z order, unless there is parallax scrolling involved it should work...

  • If you want me to, I can make you an example capx, meanwhile:

    maybe you're interested in this too

    example

    And the capx

    distance-Scale

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)