Moorky 0 Share Posted June 21, 2018 Hey guys! I've been running into a problem creating my new script. To get to the area I want the player to go, it has to go through multiple portals, doors, ladders etc. What would be the best way to handle this? First I tried to handle all the obstacles with prioritising but this doesn't work smoothly. Now I'm thinking about creating multiple areas and check in which the player currently is so it knows what to do next. (which will be a lot of code) Maybe you guys have any idea on how to handle this better? Greetings, Moorky Link to comment Share on other sites More sharing options...
Pengu 23 Share Posted June 21, 2018 You can add obstacles by doing something like this: getWalking().getAStarPathFinder().addObstacle(new PassableObstacle("Obstacle name", "Action", null, null, null)); Put it in your onStart Link to comment Share on other sites More sharing options...
Xephy 237 Share Posted June 21, 2018 2 hours ago, Pengu said: You can add obstacles by doing something like this: getWalking().getAStarPathFinder().addObstacle(new PassableObstacle("Obstacle name", "Action", null, null, null)); Put it in your onStart Nicely said. +1 Link to comment Share on other sites More sharing options...
Koschei 147 Share Posted June 22, 2018 6 hours ago, Xephy said: Nicely said. +1 Xephy always uses WebFinder Link to comment Share on other sites More sharing options...
Xephy 237 Share Posted June 22, 2018 15 hours ago, Koschei said: Xephy always uses WebFinder It's such a troll. You know how much I rage when I waste hours wondering why it's not working Link to comment Share on other sites More sharing options...
ArmyofDragons 28 Share Posted June 28, 2018 Based on the replies here, using an object such as Obstacle(String name, String action, Tile location (or int x, int y), int animationId) is a good way of presenting it that way. Also storing the animation ID would be nice, so you can check when you are done with that obstacle. And you can check for when it's complete such as: protected boolean isComplete() { return (getCurrentAnimationId() != this.animationId); } Of course you would have a delay and so on, and the above is psuedo-code. But you get the point. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.