27thColt

Members
  • Content Count

    13
  • Joined

  • Last visited

About 27thColt

  • Rank
    Member

Recent Profile Visitors

643 profile views
  1. Thank you! It helped quite a bit! But the problem itself was different from what I was thinking, which was the for loop itself, so I changed it. However a new problem arises where enemies get stuck at corners. Diagonals are already set to false in the plugin so I don't know what is wrong. New Code: //enemy actions testenemy.forEach(function(item) { //pathfinding portion let tilemap = teststageMap; pathfinder.setCallbackFunction(function(path) { item.path = path || []; goingX = item.path[1].x; goingY = item.path[1].y; finalX = item.path[item.path.length - 1].x; finalY = item.path[item.path.length - 1].y; console.log("Going to: " + (goingX * 32) + ", " + (goingY * 32) + "| Final: " + (finalX * 32) + ", " + (finalY * 32)); console.log(item.x + " " + item.y); this.game.physics.arcade.moveToXY(item, goingX * 32, goingY * 32, 75); if ( (item.x >= goingX * 32 - 1 && item.x <= goingX * 32 + 1) && (item.y >= goingY * 32 - 1 && item.y <= goingY * 32 + 1) ) { item.path.splice(0, 0); } }); pathfinder.preparePathCalculation([Math.round(item.x / 32), Math.round(item.y / 32)], [Math.round(testplayer.x / 32), Math.round(testplayer.y / 32)]); pathfinder.calculatePath(); }, this); Any help?
  2. So I kinda need a bit of help with pathfinding. I have been using the Easystar.js library as well as this pathfinding plugin for Phaser to do pathfinding for my topdown game. I ended up with this in my update function: testenemy.forEach(function(item) { //pathfinding portion let tilemap = teststageMap; pathfinder.setCallbackFunction(function(path) { item.path = path || []; for(i = 0; i < item.path.length; i++) { let goingX = item.path[i].x; let goingY = item.path[i].y; this.game.physics.arcade.moveToXY(item, goingX * 32, goingY * 32, 75); } }); pathfinder.preparePathCalculation([Math.round(item.x / 32), Math.round(item.y / 32)], [Math.round(testplayer.x / 32), Math.round(testplayer.y / 32)]); pathfinder.calculatePath(); }, this); However instead the enemy following a path around walls to get to the target player, the enemy just blindly takes a straight path towards the player so it wouldn't be able to get to me if there were any walls in it's path. Please help! I have been stuck at this problem for days and i don't know what to do!
  3. I was trying this method since I wanted a sprite to pathfind to the player. Only problem is, I keep getting this error: play.js:83 Uncaught TypeError: Cannot read property 'x' of undefined Here is the code that I used (I basically copied the code said): testenemy.forEach(function(item) { let tilemap = teststageMap; pathfinder.setCallbackFunction(function(path) { item.path = path || []; if (item.path[0] != 0) { for(var i = 0; i < item.path.length; i++) { goingX = item.path[i].x; goingY = item.path[i].y; if (item.path.length > 0) { item.path.push(goingX, goingY); } else { item.path = [goingX, goingY]; } } } }); pathfinder.preparePathCalculation([Math.round(item.x) / 32, Math.round(item.y / 32)], [Math.round(testplayer.x / 32), Math.round(testplayer.y / 32)]); pathfinder.calculatePath(); }, this); As you can tell, the problem is at goingX and goingY. I replaced the item.path.[0] with item.path.x (same with goingY) since the path stores each tile in an object, not as a 2d array. However, for some reason I keep getting that same error even though it works just fine when in the console.
  4. Hmm really? Would anyone else like to confirm this just to make sure? I kinda don't want to use P2 if I don't have to.
  5. So I am using Ninja physics for the first time for a fighting game, I figured Ninja physics would be most useful for the game. But I need help, I keep getting this error: I only get the error when I include the function collideAABBVsAABB() in my update(). Honestly, I don't know why. Here is the code:
  6. Hi guys, it is 27thColt here, back with another game. In my 2nd game, you are a guy on a bike trying to avoid and kill the robots in a fallen city. It is different than my first game and there are some things I was able to achieve which were hard before. http://27thcolt.github.io/Robot-Apocalypse/ Pics for some clicks: Github repository: https://github.com/27thColt/Robot-Apocalypse Now the game might not look updated, so I can add any suggestions you guys have. Also, make sure to report bugs and ask questions.
  7. arrow keys on the keyboard The player has a slow acceleration at the start so it might seem unresponsive.
  8. Hello! I am 27thColt. This is my first game that I have ever made! It is called Floater (couldn't think of better names). You are a Scuba Diver avoiding fish and collecting coins and bubbles! Here is the link: http://27thcolt.github.io/Floater/ Here are some pictures: If you want, here is the repository: https://github.com/27thColt/Floater Just don't steal my code guys, it's not cool. Hopy you enjoy the game!