Started working on this 'arena tester' tool that would let me load an enemy and test them, but then realized I could just make it so I can spawn enemies in the game. I'm keeping the arena around as it will be useful later as a scriptable testing tool, but for now just spawn and test.
This commit is contained in:
parent
b6c1eba1b3
commit
4f090159ab
14 changed files with 524 additions and 58 deletions
45
tools/arena.cpp
Normal file
45
tools/arena.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "arena_fsm.hpp"
|
||||
#include "textures.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "ai.hpp"
|
||||
#include "animation.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
dbc::check(argc == 2, "USAGE: arena enemy_name");
|
||||
std::string enemy_name{argv[1]};
|
||||
|
||||
textures::init();
|
||||
sound::init();
|
||||
ai::init("assets/ai.json");
|
||||
animation::init();
|
||||
|
||||
sound::mute(false);
|
||||
sound::play("ambient_1", true);
|
||||
|
||||
arena::FSM main(enemy_name);
|
||||
|
||||
main.event(arena::Event::STARTED);
|
||||
|
||||
while(main.active()) {
|
||||
main.render();
|
||||
|
||||
// ZED: need to sort out how to deal with this in the FSM
|
||||
if(main.in_state(arena::State::IDLE)) {
|
||||
main.event(arena::Event::TICK);
|
||||
}
|
||||
|
||||
main.keyboard_mouse();
|
||||
|
||||
main.handle_world_events();
|
||||
}
|
||||
|
||||
return 0;
|
||||
} catch(const std::system_error& e) {
|
||||
std::cout << "WARNING: On OSX you'll get this error on shutdown.\n";
|
||||
std::cout << "Caught system_error with code "
|
||||
"[" << e.code() << "] meaning "
|
||||
"[" << e.what() << "]\n";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue