An extremely minor spelling correction in the guide:
their’s -> theirs
And I suppose it is better to use
this.remember === undefined
instead of
typeof this.remember === ‘undefined’
but that is also quite minor (and also something I suggested myself ).
Otherwise I think the guide and the level are good. I’m very glad your guide shows us how to initialise variables. Maybe there should even be a snippet based on this, or maybe the snippet on functions should contain this.
In addition, I think your description of the obstacles/“playable area” is very good. I like the idea that you leave the square, but that it is easier not to.
Have you decided what you want to do with the cooldown yet? I kind of liked my own myAttack function that kept track of the cooldown.
Yeah, my archer Stutter stepped quite nicely. But the attack animation of the archer takes quite long (I’d say 0.4 seconds), so you only get 0.2 seconds of free movement per shot (with a cooldown of 0.6).
The following code will make the archer “stutter”. There is some duplicate logic here, but only because myAttack is meant to always set the cooldown correctly, even when used by somebody who tries to attack when the cooldown is active :P.
I just added a starting storyline to the level. I had issues with the camera placement, it didn’t want to point at what I told it to, so it is just stationary. What do you all think?
Hey, I quite liked the intro. But now it seems this.range is undefined. Also the guide talks about the town square, but you have changed the area to grass. Lastly, what do feel about the difference between move and moveXY? I personally prefer move, as I think it makes for prettier code. But I also think it may be harder to use, as you may have to pass it an object like {x: X, y: Y}.
And it turns out it is possible to influence the starting position of the archer by pressing shift+space a lot of times very quickly at the start. But I’d say that is only a minor issue. I see that range is undefined because you changed the name to attackRange in one place, but not in the other. I have made a few changes, maybe I will suggest a patch.
I agree, I like the name this.move better, but the arguments of this.moveXY better. Would be nice to simply have this.move and it can take a thang, a pos object, or 2 numbers.
Ah, nice patch, you made all the changes I was hoping for. I’m especially glad that we can now use both moveXY and move :). Note that move also works with vectors, which I think is sweet :).
Maybe I should finally solve the level now then :P. I’m being a bit perfectionistic about it, I don’t want to make a hacky solution, but rather a general one. But that is hard.
python code, 12 lines (with no errors for getting distance to undefined)
Though I just dropped that time to 1:41.6 by changing a constant slightly. But the ogres appear randomly at the start, so anything within a few seconds of each other could be simply because of the random placement.
Nice, I was thinking that some following a circular path might do better. Still pretty close considering the random placement, but it seems reasonable that it would out-perform my rectangle.