Dynamic layer levels with ImpactJS?

For discussions about game development that does not fit in any of the other topics.
Post Reply
Aristona
Posts: 7
Joined: Sun Apr 28, 2013 9:23 pm

Dynamic layer levels with ImpactJS?

Post by Aristona »

Hi,

I have a small problem with ImpactJS. I need to make my entity lower level when he is behind objects and higher level when he is front of objects.

To solve this, I did a small workaround.

- Applied collision area to the feet of my player entity
- Updated my Layers to look in this order
1. Behind Objects
2. Entity
3. Front Objects
4 . Collision
5.Terrain

Right now it works and I'm pretty happy with it. Like in this picture: http://i.imgur.com/jclslIu.png

However, this workaround is not possible with the following tileset. (or when the tileset is a single cell one)
Have a look at: http://i.imgur.com/QRZXygu.png

So I need a small script to do something like this:

- The tileset 1 level below my entity object should automatically get a higher level layer position.

For example, if I go behind the rope, rope should be 1 level higher than my entity layer so I will look like I am behind it. Also, if I am in front of rope, my entity should be 1 level higher than rope layer so I will look like I am in front.

Anyone knows how can I do this?

Thanks in advance!
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Dynamic layer levels with ImpactJS?

Post by hallsofvallhalla »

yeah thats is a common problem with working with tilesets. The way most people deal with it is create collision to keep the player from being able to be in front and behind the object but also changing the bounding box around the player to shrink collisions and help prevent it.
Post Reply

Return to “General Development”