New Level: Hit'n'Run


Hey guys,

Please try my new level and give me feedback or blame me, it’s all welcome!
The level is not presented very nicely, but I think it’s an interesting problem to kill the ogres.

I’d love to see your solutions and hear your ideas! Any help with making this level nicer is apprechiated.



Hmmm, looks fun, but I can’t seem to setAction. setAction isn’t listed under available spells, but action is, and its directions say to use setAction. Not sure if I’m just not coding properly or what. Thinking something like:

if this.distanceToEnemy()>12:
elseif distance<=5:
setTarget(point in opposite direction of enemy)

But I can’t use setAction :frowning:


now I think I gave you setAction. before only attack() was working. sorry about that!
And I noticed the distanceToEnemy() isn’t doing anything, but you can use the ownMethod() tab to write it yourself instead. I’ll take it distanceToEnemy away for now until I can define it.


This was pretty fun. Here’s my solution’s battlefield:

Would love to hear if you had any further frustrations with the level editor as you were working on this or things you wished you could do but didn’t know how.

Might be interesting to do this with a ranged unit, like an Archer, and a lot more baddies, so that the kiting makes more visual sense (and leads to a more epic battle, with dead ogres everywhere). Adding some doodads would make it look cooler, too.

You should be able to just include distanceTo in the Programmable’s programmableProperties to let anyone call it, instead of making them define it or defining it yourself.


I got it, similar final battlefield as yours nick.

Curious how moveXY works, does it automatically get interrupted each instance? Thus, moveXY is really just saying move toward XY? I originally thought I’d move all the way there before checking anything else.

Is it possible to generate random numbers? Would be fun to have me move in a random direction when fleeing (though I’d make sure it wasn’t directly at him.)


In the chooseAction method, it determines what action to take once per frame when the Thang can act. So it can update its action and movement target using the moveXY method each frame, yeah. In the beginner levels we use the plan method and the programming.Plans Component, which actually interrupt the player’s code execution in order to make a moveDown wait until the Thang actually gets there, but chooseAction is much simpler to work with.

You can generate random numbers if you include the programming.UsesMath Component with the random property included.