Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Donzo

Hi.

I had two issues with the pass through tiles about which I was wondering:

1. I'm using the same bounce detection code that came with Jumpnrun -

	handleMovementTrace: function( res ) {
		this.parent( res );
		if( res.collision.x || res.collision.y ) {
			
			// only bounce 3 times
			this.bounceCounter++;
			if( this.bounceCounter > 2 ) {
				this.kill();
			}
		}
	},

but I'm also using lots of one-way tiles.
The problem is that the projectiles don't seem to recognize collisions on the one-way tiles using res.collision.x

If the player is shooting a lot, the level becomes polluted with these trapped projectiles that eventually consume all of the resources.

Is there a way to tweak res.collision.x or add some property or something that would recognize collisions with the one way tiles? How could I do this?

2. One-way tiles are fun, but sometimes the player knocks into them and it makes the jumping experience less than smooth. Rather than having entities only pass through one-way, is there a way to tweak it so that they only collide one-way? In other words, can they pass though the tiles moving three directions (forward, backward, and upward for instance) and only collide with one side of the surface?

1 decade ago by dominic

One way tiles are internally handled as slopes, so you can check for res.collision.slope.

Also, if there's a slope collision you get some additional info:
res.collision.slope = {x: lvx, y: lvy, nx: nx, ny: ny};

x, y is the direction of the slope and nx, ny is the normal. You could use this to do some more calculations, if the player should pass through the tile or not. I'm afraid there's no easy way to do this, though.

1 decade ago by Donzo

Thanks, Dom!
Page 1 of 1
« first « previous next › last »