var socket = io.connect(); var App = {}; App.main = {}; const chara = "file:///home/h28j/h28j028/csd/pictostand.png"; const punch = "file:///home/h28j/h28j028/csd/Project_g_02/work/picto/picto_punch.png" const kick = "file:///home/h28j/h28j028/csd/Project_g_02/work/picto/pictokick2.png" const jump = "file:///home/h28j/h28j028/csd/Project_g_02/work/picto/pictojanp.png" var player_info = { id : "", x : 0.1*WIDTH + Math.floor( Math.random() * (WIDTH*0.8) ), y : 0.1*HEIGHT + Math.floor( Math.random() * (HEIGHT*0.8) ), }; var player = null; var playerid; var enemies = {}; socket.on('connect', function() { player_info.id = socket.id; if(playerid == undefined) { playerid = player_info.id; } console.log('my id is ' + playerid); }); enchant(); function updatePos(unit) { unit.x ++; unit.y ++; }; App.main.Player = enchant.Class.create(enchant.Sprite, { initialize: function(posx, posy) { enchant.Sprite.call(this, 32); this.gamecore = enchant.Core.instance; this.image = this.gamecore.assets[chara]; this.frame = 13; this.x = posx; this.y = posy; }});