1 decade ago
by 80bit
I found and setup the collision detection between 2 sprites but is there a way to easily perform action when collision is no longer 'true' for example at
http://Mantrakid.com/secret when link walks away from the radio, it shuts off? I suppose I can have invisible triggers outside of the radio area that trigger music to stop? Or is there a better way? Thx!
1 decade ago
by dominic
Well the collision ends as soon as you stop walking against the radio. When a collision occurs, the two entities are moved apart so that there no longer is a collision.
Using an invisible trigger entity would be one solution for your problem. You could also make the radio non-solid (
ig.Entity.COLLIDES.NEVER
) and use its
.check()
method that is triggered when both entities overlap.
Or just check the proximity of the player to the radio:
// In the radios update() method
var player = ig.game.getEntitiesByType( EntityPlayer )[0];
if( player && this.distanceTo( player ) < 128 ) {
// do something
}
Hello, this is old but it showed up in my Google results. You can find the answer here
http://impactjs.com/forums/help/fixed-entities-collision. Which is to set the player to a light collision and boxes to active. Works great.
Page 1 of 1
« first
« previous
next ›
last »