Jump to content

Search the Community

Showing results for tags 'sprite path walk'.

  • 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. I use easystarJS and the PhaserPlugin to generate coordinates for pathfinding. This works well and I've got an array called "Path" which contains every x/y coordinates that a sprite should be moved to. The pathfinding "Event" fires 1 time when clicking on a map layer. some code: this.findPathTo = function(tilex, tiley) { pathfinder.setCallbackFunction(function(path) { //callback with path var path = path; //path array with ever x / y coordinate for every tile to walk over for (var i = 0, ilen = path.length; i < ilen; i++){ var num = i;/* setTimeout(function(){// This is a bad idear, what to put here? console.log(path[num]); reference.DBugger.x = path[num].x * 20; reference.DBugger.y = path[num].y * 20; }, 100);*/ } }); pathfinder.preparePathCalculation([0,0], [tilex,tiley]); //pathfinding functions pathfinder.calculatePath(); //pathfinding functions }What I want to achieve is that the Sprite => reference.DBugger (Sprite for testing) moves through all the coordinates in that array piece by piece. If I uncomment that function atop, the sprite is already at the position were I have clicked. The best way would be some function that checks when the sprite has reached path[0] coordinates and then applies path[1] coordination and so on. any suggestions? kind regards
×
×
  • Create New...