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 Skywalker

i have this function in an entity:
scale: function(scale){
if(this.anims.right.sheet.width == this.defaultAnimSize.x){
this.anims.right.sheet.image.resize(scale);
this.anims.right.sheet.image.width *=scale;
this.anims.right.sheet.image.height *=scale;
this.anims.right.sheet.width *= scale;
this.anims.right.sheet.height *= scale;
}
this.size.x *= scale;
this.size.y *= scale;
this.offset.x = this.offset.x * ( scale / 50 );
this.offset.y *= scale;/

}

this part "this.offset.x = this.offset.x * ( scale / 50 );" is throwing an error when I run my game: "Uncaught SyntaxError: Invalid regular expression: missing /"

maybe I'm just not seeing it but what it causing it to look for a regex instead of dividing?

1 decade ago by Skywalker

wow....so after pasting my code on here I saw the problem. the / at the end of the function was practically invisible in notepad++ with my current styling
/facepalm

1 decade ago by Arantor

Also note that you can mark your code with ## at the start and end and get it formatted too ;)
Page 1 of 1
« first « previous next › last »