Problems implementing Jumper, and optimisation. [SOLVED]
Posted: Sun Nov 03, 2013 3:03 am
I'm having some trouble implementing pathing in to a very rudimentary roguelike using Jumper. I'm not particularly attached to Jumper, so if it ends up not being the best thing for what i'm trying to do, changing isn't that much of an issue. That being said, here's the problem.
I can calculate a path, and detect when that path is below a certain value, and change them to "aggressive". My problem is once they're aggressive, I can't figure out how to, well, do the actual pathing.
The nodes aren't generated for every coordinate, so I can't just be like "move to the first step in the path.", there's a command to do that (path:fill()) But I have no idea where to put that, or when to run it.
My biggest problem, isn't actually an error, but generating a path every time it's the enemies turn to move, for each enemy, is going to lag the game, and at one point I had it kind of working, and there was a noticeable drop in the movement animation. I'm very, very new to programming, so I realise i'm going to be awful at optimisation. I'd appreciate anyone willing to take a look-see through the code, and point out anything I could do better.
Controls:
I can calculate a path, and detect when that path is below a certain value, and change them to "aggressive". My problem is once they're aggressive, I can't figure out how to, well, do the actual pathing.
The nodes aren't generated for every coordinate, so I can't just be like "move to the first step in the path.", there's a command to do that (path:fill()) But I have no idea where to put that, or when to run it.
My biggest problem, isn't actually an error, but generating a path every time it's the enemies turn to move, for each enemy, is going to lag the game, and at one point I had it kind of working, and there was a noticeable drop in the movement animation. I'm very, very new to programming, so I realise i'm going to be awful at optimisation. I'd appreciate anyone willing to take a look-see through the code, and point out anything I could do better.
Controls:
- Numpad 1-9 for movement.
- Numpad + to spawn an enemy.
- Numpad Enter to check who's "aggroed"