Level Idea: Can You Be Precise?


#1

Me again, with another mathematical ideal for a new level. Like I mentioned in the “Extra extrapolation” topic, I love mathematics and this game could have a mathematical section with games focused on math solutions.

Can You Be Precise: Emphasis on Aim is a great level that can have a follow-up level with the difficult increased. The idea would be to send ogres following the Fibonacci sequence. But in this level, you can’t use getEnemies() or anything like that. This time, the shooting position has been previously established and all ogres will step on that spot at some point during the course. After the first ogre has been killed, the player would use Fibonacci sequence to determinate when the next shoot should happen. Of course, that information should not be explicitly , but rather just a hint to the ogres sequence pattern. The distance between the one ogre and the next or the time between one ogre reaching the spot and the next (don’t know which is best) would be Fibonacci’s sequence.


#2

Interesting! Lots of possibilities here. I think what would really help nail this one down would be to figure out what the code for the solution might look like. (You can put code in [ spoiler][ /spoiler] tags if you don’t want to give it away.) Then we can figure out what needs to happen for the level to be able to support it.

Totally digging the math games campaign concept, by the way.


#3

This one would be more brain activity than coding. A solution for this one would be something like:

Main.js

// This is the constant time that the ogre takes to walk from the edge of the screen to the shooting spot.
var pathTime = 4;

// Get the amount of dead ogre to establish the waiting pattern.
var count = countDeadOgres();

// Wait for the ogre to reach the spot.
wait(pathTime + this.WaitingPattern(count));
this.attack();

WaitingPattern.js

if(count == 0 || count == 1)
    return 1;
 return WaitingPattern(count - 1) + WaitingPattern(count - 2);

#4

Okay, I can see how this could work. I think the wait() would work better in a plan()-based method, so you’d have your own loop in there, but the interesting part is the Fibonacci, so you’d probably provide all of the plan() code from the start.

I’ll see about adding wait(), and when I do, I’ll post back here.


#5

@deleugyn I’ve added an action.Waits Component, which adds a wait(t) method you can use as a programmableProperty in the Programmable Component to wait for t seconds. Should work in either plan()- or chooseAction()-based methods.

I know you expressed entirely understandable confusion with the undocumented, in-progress level editor, but it sounded like @Aftermath might be interested in collaborating on some of these levels with you. He has done an amazing job of figuring out the level editor so far.

Also, instead of making a new countDeadOgres() method, here’s a more general technique the tower could use:

    ...
    this.attackXY(30, 20);
    if(!this.shotCount)
        this.shotCount = 0;
    ++this.shotCount;

You can increment your own counter to count anything, like the number of times you attack, or the number of ogres you killed. You could then pass this.shotCount to the function to determine how long to wait.