New level : Mad Maxer


#1

I used Python but the example code looks like Javascript. I’ll just put this here for now… are these instructions still good?

# Kill the enemy that's farthest away first.

loop:
    maxDistance = 0
    enemyIndex = 0
    enemies = self.findEnemies()

    # Look at all the enemies to figure out which one is farthest away.
    while enemyIndex < len(enemies):
        target = enemies[enemyIndex]
        enemyIndex += 1

        # Is this enemy farther than the farthest we've seen so far?
        distance = self.distanceTo(target)
        if distance > maxDistance:
            maxDistance = distance
            farthest = target

    if farthest:
        # Take out the farthest enemy!

#2

it worked for me. If only I would become powerful enough to kill everyone!


#3

@jklauser Did you perhaps open the level before this morning? I added the sample code for Python this morning, but if you opened the level before it had Python sample code, it may have saved your old (defaulted-to-JS) code until a code reload.


#4

How powerful do you need to be to defeat this level? The code works fine, but I bought the Claymore Sword for Tharin (501 health) specifically for this level. Can people post their stats when they beat this level? Thanks.


#5

@nick I don’t think I was in it before I received the announcement e-mail. :confused:


#6

I think I may have figured it out.

When I followed the link from the e-mail I changed my language at the hero select screen from Javascript to Python. For some reason I got the initial code in Javascript and the Python interpreter. I experimented with the remaining links and had the exact opposite (or same?) experience switching from Python to Javascript. I got an editor full of Python code and a slew of Javascript errors.


#7

I was able to beat it with this gear:

That is a total of 501 health and just the longsword. It was close though. I had to use both cleave and bash. That pointy shield’s bash is sweet!


#8

I just barely made it also (ended with health = 10). I started with 782 health and dark-steel and only used attack. I would’ve done something more than just simple attack if necessary but that was on the first try just to see how the level worked.


#9

I lost with this code :

if farthest:
        # Take out the farthest enemy!
        self.attack(farthest)

I won with this code :

if farthest:
        # Take out the farthest enemy!
        self.attack(farthest)
        farthest = None

#10

Hmmm… I don’t know why the farthest=None would do anything. Looks like it would be redundant since that is also done at the top of the loop. Possibly you got different results just b/c the random seed gets reset on each submit.

Btw, you indented twice there (8 spaces instead of 4 assuming you are using default indentation of 4). Not sure if it matters in this case, but it can in some cases.


#11

when farthest=none, then wouldn’t the hero just attack the closest enemy instead of the farthest one?


#12
if farthest:
        # Take out the farthest enemy!
        self.attack(farthest)
        farthest = None

With this code my hero attack and don`t kill the enemy that’s farthest away first .
That goes against the original idea of the level…


#13

This is where gear dependence makes your life difficult.what you realy want to do is something like:

loop:
    enemy = findFurthestEnemy()
    while isAlive(enemy):
      self.attack(enemy)

This is pesudocode and you won’t be able to use it directly, but you will be well served by thinking about how to implement those two functions.


#14

Note on maybe a small bug, I used the knockback on Mad Max or “kitara” for dragon lance fans and she flew off the screen not to be seen from again. I don’t know if you would call this a bug but thought I should let you know. Fun level either way.


#15

I too knocked the dragon rider off screen through a crack between the rocks with a powered-up “great sword”, except my hero managed to follow it off screen and never come back.
BTW it looks like when I do an “attack” that knocks the enemy back and kills it in one blow, my guy still feels the need to walk all the way to the dead body before returning from the “attack()” method.

But the cleaving sword is a better choice for this level, a single cleave kills off all the munchkins, you just have to wait for all of them to get in range.

I beat the level by killing the closest shaman first, then the farthest :smile:

I always wondered about those bashing shields: what good is a “secondary attack” if you can’t do the two in parallel?
(same with not being able to walk while shielding.)


#16

The bash shield does significantly more damage than the great sword. my typical combat code looks something like:

if enemy.health > 200:
    powerUp()
    attack()
elif enemy.health > 50:
    bash()
else:
    attack()

The knockback and having an attack at all is also useful if you have the hammer equipped instead of a sword.


#17

How were you able to use your long sword on this level, the level says that the long sword is restricted on this level for me and I haven’t been able to use it? I’ve also been having difficulties with this level, but I believe it is only because I am trying to beat it with a short sword (with a pretty decent health though). I just hope I don’t have to buy another sword just to beat this one when I should be able to just fine with the long sword I already have.


#18

We just recently restricted the longsword, because the cleave ability is messing with our ability to get you to target the furthest enemy (since you could otherwise just cleave almost everyone and not do the real solution code). Short sword is definitely too weak to fight these guys, though, unless you are really good at using bash on the fangrider and shamans, maybe. (We also made it so the fangrider can’t fly through the rocks any more.) We may need to do further work on this level for balancing it, since in some gear setups it can still be too hard.


#19

Thanks for the clarification nick, would it be possible to maybe just disable the cleave ability for the level instead of restricting the long sword? It’s just difficult to know what to do with your gems if you don’t know ahead of time that your weapon isn’t going to be allowed on a level and that my only back up weapon isn’t going to be good enough. It puts you in a bind if you just spent your gems upgrading something else. Or maybe if there was a way to sell back equipment that you no longer need (not for full price of course).


#20

It’s a good point about the long sword, but the long sword is a little underpowered compared to the weapons you need to be effective as a warrior for the levels around this and the later levels in general, so we do want to move you towards buying one.

We are certainly planning to add selling, more gems due to more levels, and more opportunities to snag gems (like winning in multiplayer and simulating multiplayer matches). If you’re stuck, I can reset your gem purchases (but don’t all everyone else be askin’ unless they really need it, 'cause I’d rather solve the other problems than spend time modifying everyone’s gems).