Jump to content

Search the Community

Showing results for tags 'easystarjs'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi This is a basic project from phaser quest that i have forked https://github.com/claudelebrun/basic-mmo-phaser i would like to use easystarjs to move the player from a point to another it finds a path with a basic tilemap but i want to make the player moves and i don't know how here is the code of the moving function that was a tween before and now it uses easystarjs Game.movePlayer = function(id,x,y){ var player = Game.playerMap[id]; var m = game.cache.getTilemapData('map').data.layers[0].data; /* var grid = [[11,11,11,11,11], [11,11,11,11,11], [11,11,11,11,11], [11,11,11,11,11], [11,11,11,11,11]]; */ var myGrid = new Array(); for(i=0; i<23; i++){ myGrid[i] = new Array(); for(j=0; j<16; j++){ myGrid[i].push(m[i*j]); console.log(myGrid[i][j]); } } easystar.setGrid(myGrid); easystar.setAcceptableTiles([11]); /* console.log(Math.floor(player.x/32), Math.floor(player.y/32)); console.log(Math.floor(x/32), Math.floor(y/32)); */ easystar.findPath(Math.floor(player.x/32), Math.floor(player.y/32), Math.floor(x/32), Math.floor(y/32), function( path ) { if (path === null) { console.log("Path was not found."); } else { console.log("Path was found."); var tween = game.add.tween(player); var duration = 1000; for(i=0; i<path.length;i++){ console.log(path[i].x + " " + path[i].y); tween = game.add.tween(player).to({ x: path[i].x*32, y: path[i].y*32 }, 1000, Phaser.Easing.Linear.None, true); } } }); easystar.calculate(); };
×
×
  • Create New...