The pirates follow the captain into battle like lemmings. Therefore the captain is the most important pirate to preserve. The more pirates you manage to move through the level the more successful your raids. Exit bottom left. Avoid the skeletons.
Use the mouse to open the trapdoors and stairs and to close them.