SFML community forums
Help => General => Topic started by: Jim70 on May 28, 2015, 10:03:42 am
-
I have a basic ai system, how do i do it so that i dont have to re-write the code for every ai i add with the same functionality?
-
It's a very broad question (and not really related to SFML), can you be a bit more specifc?
-
so that i can have one class (with sf::texture, sprite, private & public variables etc) and reference it more than once and display the on screen.
-
Use a container such as std::vector?
-
isnt there something like LOL lol = new LOL ?
-
I think you should get a good C++ book (https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) and learn about classes and STL containers.
-
For once I agree with eXpl0it3r....
You should probably learn c++ before you try using it. And your question is extremely broad, to the extent that it even extends to the programming model your using... OOP, ECS, etc... Your just going to have to figure out a model and run with it, then you can easily find a way to single out specific segments of your program such that it reduces or even erradicates redundancy....
GL
-
You can use virtual functions , or overloaded functions too, inclusive you can embed a script language such lua , python , ruby for the AI.. etc..
If the part of class/templates of c++ you don't know so well , buy a book (more recommendable) or google for tutorials.
http://www.cplusplus.com/files/tutorial.pdf
http://www.cprogramming.com/tutorial/c++-tutorial.html
http://www.cprogramming.com/tutorial/c++-tutorial.html