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

10 years ago by papyhardcore

Hi,

I have two entities :
My player : Player.js
Player.js

My save point : SavePoint.js
SavePoint.js

I wan't to detect collision between player and save point.
I try to use check function in Player.js
check: function(other){
                    if(other instanceOf EntitySavePoint){
                        console.log('save');
                    }
                }

But I have an error : Uncaught SyntaxError: Unexpected identifier for
                check: function(other){

Thx for your help

10 years ago by papyhardcore

Syntax error :
check: function( other ) {
                    if(other instanceof EntitySavePoint){
                        console.log("save");
                    }   
                     
     },

and not instanceOf .

But no console.log("save") when there is collision.

10 years ago by Joncom

In player.js...
checkAgainst : ig.Entity.B,

should be...
checkAgainst : ig.Entity.TYPE.B,

10 years ago by papyhardcore

I love you.
Thx !!

10 years ago by Joncom

Happy to help.
Page 1 of 1
« first « previous next › last »