Depending on the complexity of the AI, it can be done with relative ease. The harder and more versatile the AI, the harder it will be to make. The basic structure of it is you are feeding the actor a bunch of triggers. It should know how to handle them. One case is to dodge. If you want it to dodge when an enemy attacks, one way of doing it is to tell it to jump. This also depends on how many enemies and players. But you should start with a basic idea and build from that.
- Code: Select all
if (player.x-x<200 && ATTACK==1)
{
// your dodge script... an example being
//ChangeAnimation(jump);
//yvelocity-=5;
}
This is not the best way of doing it, but it is one of the easier ways. To make this better, you would need to set up a pretty complex system that when used, the AI can determine what to do. As I said before, this is the basics. You can also throw in rand or other factors to make the AI less smart. That way it will only get it sometimes, or if you get farther into it, it has a choice and will pick, whether it is best or not. Level switching I am fairly certain there are demos on this. If you can't find any I can point you in the right direction. As for pause menus, I am not sure there is a built in way, but all you would need to do is disable the actors, either by the disable event or through your own means. The only actor that should receive events would be the menu. You could do it this way, though I hope there is a better way. In all actors you wish to pause, put an if statement in all of there events that allows them to move only when the menu is not up. I can explain further if need be.