obfuscation - How to properly obfuscate javascript code with javascript2img? -


i tried obfuscating js code using javascript2img. gave me obfuscated code. state, "copy code , paste js or html file. that's all!". keep getting error. "uncaught syntaxerror: unexpected identifier game.js:1"

un-obfuscated code works fine.

example: following doesnt work obfuscated without obfuscation.

var game = new phaser.game(400, 490, phaser.auto, "gamediv");  var mainstate = {      preload: function() {          if(!game.device.desktop) {             game.scale.scalemode = phaser.scalemanager.show_all;             game.scale.setminmax(game.width/2, game.height/2, game.width, game.height);         }          game.scale.pagealignhorizontally = true;         game.scale.pagealignvertically = true;          game.stage.backgroundcolor = '#71c5cf';          game.load.image('bird', 'assets/bird.png');           game.load.image('pipe', 'assets/pipe.png');           // load jump sound //        game.load.audio('jump', 'assets/jump.wav');      },      create: function() {          game.physics.startsystem(phaser.physics.arcade);          this.pipes = game.add.group();         this.timer = game.time.events.loop(1500, this.addrowofpipes, this);                     this.bird = game.add.sprite(100, 245, 'bird');         game.physics.arcade.enable(this.bird);         this.bird.body.gravity.y = 1000;           // new anchor position         this.bird.anchor.setto(-0.2, 0.5);           var spacekey = game.input.keyboard.addkey(phaser.keyboard.spacebar);         spacekey.ondown.add(this.jump, this);          game.input.ondown.add(this.jump, this);          this.score = 0;         this.labelscore = game.add.text(20, 20, "0", { font: "30px arial", fill: "#ffffff" });            // add jump sound         this.jumpsound = game.add.audio('jump');         this.jumpsound.volume = 0.2;     },      update: function() {         if (this.bird.y < 0 || this.bird.y > game.world.height)             this.restartgame();           game.physics.arcade.overlap(this.bird, this.pipes, this.hitpipe, null, this);           // rotate bird downward, point.         if (this.bird.angle < 20)             this.bird.angle += 1;       },      jump: function() {         // if bird dead, can't jump         if (this.bird.alive == false)             return;           this.bird.body.velocity.y = -350;          // jump animation         game.add.tween(this.bird).to({angle: -20}, 100).start();          // play sound //        this.jumpsound.play();     },      hitpipe: function() {         // if bird has hit pipe, have nothing         if (this.bird.alive == false)             return;          // set alive property of bird false         this.bird.alive = false;          // prevent new pipes appearing         game.time.events.remove(this.timer);          // go through pipes, , stop movement         this.pipes.foreach(function(p){             p.body.velocity.x = 0;         }, this);     },      restartgame: function() {         game.state.start('main');     },      addonepipe: function(x, y) {         var pipe = game.add.sprite(x, y, 'pipe');         this.pipes.add(pipe);         game.physics.arcade.enable(pipe);          pipe.body.velocity.x = -200;           pipe.checkworldbounds = true;         pipe.outofboundskill = true;     },      addrowofpipes: function() {         var hole = math.floor(math.random()*5)+1;          (var = 0; < 8; i++)             if (i != hole && != hole +1)                  this.addonepipe(400, i*60+10);             this.score += 1;         this.labelscore.text = this.score;       }, };  game.state.add('main', mainstate);   game.state.start('main');  


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -