// W tym poziomi użyjesz funkcji z dwoma parametrami
// Look at the structure below, notice how there are two arguments.
// These are both accessible within the function.

function checkAndAttack(x, y) {
    // First move to the coordinates provided by the parameters.
     hero.moveXY(x, y);
    // Następnie sprawdź czy jest wróg

// A forgotten tomb in the forest!
// But the ogres are hot on your heels.
// Break open the tomb, while defending yourself from the munchkins.

// This function should attack an enemy if it exists, otherwise attack the door!
function checkToDefend(target) {
    // Check if the `target` exists
    if (target) {
        
    

// This shows how to define a function called cleaveWhenClose
// The function defines a parameter called `target`
function cleaveWhenClose(target) {
    if(hero.distanceTo(target) < 5) {
        // Put your attack code here
        // If cleave is ready, then cleave target
        if (hero.isReady("cleave")) {
        hero.cleave(enemy);
        }

// Gather 4 lightstones to defeat the Brawler.
// If you find a lightstone, hide.

function checkTakeHide(item) {
    if (item) {
        // The item is here, so take it.
        hero.moveXY(item.pos.x, item.pos.y);
        // Then move to the center of the camp (40, 34)
        hero.moveXY(40, 34);
    }
}