1. 16 Dec, 2016 4 commits
    • Terence Martin's avatar
      Position player properly · e4d87f90
      Terence Martin authored
      Using the new API, we position the player above the first column in
      the maze.
      e4d87f90
    • Terence Martin's avatar
      Give Player entity a reference point · 9dddef01
      Terence Martin authored
      This adds a reference point property to the player entity, which it
      will use to update its position on screen.
      
      This is done in combination with its map posiition and this reference
      position so that we can easily shift the player around and still know
      what position it's in.
      9dddef01
    • Terence Martin's avatar
      Include a Player into the game · 74392e29
      Terence Martin authored
      This is currently crude, as the player remains stationary at the upper
      left corner, but it's enough to prove everything is working as
      expected.
      
      This uses the spacebar as the push key (which seems more natural), so
      the debug toggle key is now F12.
      74392e29
    • Terence Martin's avatar
      Include Player entity · 499a0bde
      Terence Martin authored
      This is the first crack at this. THe player can face a direction and
      push in all directions, and is capable of not running an action until
      its  current action is completed.
      499a0bde
  2. 15 Dec, 2016 12 commits
    • Terence Martin's avatar
      Clean up debugging calls · cf426ef5
      Terence Martin authored
      Shift the onus of checking to see if debugging is turned on or not
      from the calling class to the MazeDebugger class, which leaves without
      doing anything if debugging is not turned on.
      
      A boolean return tells you if anything was done or not, so that the
      Scene can eat keys as needed.
      cf426ef5
    • Terence Martin's avatar
      Shift debug flag to the debugger object · 1bcd5b79
      Terence Martin authored
      This moves the flag that says if the debugger is turned on or not into
      the debug object itself. This lengthens the code a bit but finishes the
      isolation.
      1bcd5b79
    • Terence Martin's avatar
      Refactor most debugging code into a new class · 272b499a
      Terence Martin authored
      This does for debugging what the previous commits did for the
      generation of the maze. This pulls all of the debug options out and
      puts them into their own class.
      
      This still needs a bit of work, si\nce the flag and a couple of other
      things are still held in the Maze.
      272b499a
    • Terence Martin's avatar
      Rearrange debug code a bit · 40494759
      Terence Martin authored
      This cleans up the debug code by moving one last function upwards to
      where it lives.
      40494759
    • Terence Martin's avatar
      Refactor Maze generation · f0224daa
      Terence Martin authored
      This shifts the code that generates the maze into its own class, which
      shortens up and clarifies the Maze code itself and also makes it
      easier to tweak generation in the future, since it will be self
      contained.
      f0224daa
    • Terence Martin's avatar
      Clarify ball dropping · 549186a3
      Terence Martin authored
      There were several places where code was being used to check if a cell
      in the maze was blocked or not. This has been factored out into the
      MazeContent class so that we can easily do it in one step.
      549186a3
    • Terence Martin's avatar
      Implement simple accessors for ActorPool access · 3d835944
      Terence Martin authored
      This simplifies the code marginally for the purposes of pulling an
      entity out of the associated ActorPool instance, but exposes a simple
      method for external code to be able to get at our entities so that the
      debug code can go away.
      3d835944
    • Terence Martin's avatar
      Remove the last of the instanceof uses · 5568b6a9
      Terence Martin authored
      This implements a new helper in the MazeContent entity that allows you
      to fetch the name of the entity at a given location with a built in
      null check.
      5568b6a9
    • Terence Martin's avatar
      Fix missing documentation in Teleport entity · e1e4797a
      Terence Martin authored
      All I can say is, whoops.
      e1e4797a
    • Terence Martin's avatar
      Remove almost all of the instanceof uses · 795e459e
      Terence Martin authored
      We now favor using the internal name of the entity, which for our
      purposes here is the name provided to the MazeCell constructor.
      
      ts-game-engine uses this for debugging so it's exposed, but it
      probably should be. This has been added to the new interface to
      remind us that it should be added along with everything else.
      795e459e
    • Terence Martin's avatar
      Add kill() method to MazeCell and new interface · b64b9a85
      Terence Martin authored
      In order to make code even clearer that wants to kill an entity based
      on its pool, add a kill() method directly to MazeCell that invokes the
      killEntity() method for us as a convenience.
      b64b9a85
    • Terence Martin's avatar
      Use new pool tracking for easier disposal · d0d9d641
      Terence Martin authored
      In order to make the code a little clearer in a few places, instead of
      having wordy code to select the appropriate pool for killing an
      entity, we can just use its pool directly.
      d0d9d641
  3. 14 Dec, 2016 5 commits
    • Terence Martin's avatar
      Add ActorPool tracking to MazeCell · 4fdee268
      Terence Martin authored
      This adds to ActorPool an interface that extends the Actor class and
      adds a single optional parameter named "pool" that is an ActorPool.
      The ActorPool generic description now says that it takes an object of
      this new interface, which means it works with any Actor which may
      optionally have such a  property.
      
      The MazeCell entity adds this property, which means that all
      subclasses get it as well.
      
      The idea here is that any entity that is stored in an ActorPool tracks
      its pool, which means that we can use any entity to remove it from the
      associated pool (if desired) without having to know what type of
      object that is is.
      
      This is defined in this manner (optional parameter) so that we don't
      have to update the Actor class in ts-game-engine to provide this
      property by default. This will happen when this class gets rolled into
      ts-game-engine.
      4fdee268
    • Terence Martin's avatar
      Create new MazeContent class · a277ce17
      Terence Martin authored
      This class wraps the maze contents and the operations for getting and
      setting cells and markers in it, removing that from the Maze itself.
      
      This cleans up the code and also allows us to  do something like pass
      the content easily as a get() property so that e.g. the scene that owns
      us can modify, which means we can also get a bunch of the debug code
      out of there as well.
      a277ce17
    • Terence Martin's avatar
      Alter drop speed for end of game · 28cef7d2
      Terence Martin authored
      The ball speed while dropping should be faster at the end of the game
      than it is while things are being played normally since there are
      conceivably many ball in this situation and we don't want it to take
      forever.
      28cef7d2
    • Terence Martin's avatar
      Refactor ball dropping code · fdc8455c
      Terence Martin authored
      Shift the code that sets up for a ball move to be in its own method so
      that it is not duplicated in multiple places, since we need to be able
      to do it manually and also automatically.
      fdc8455c
    • Terence Martin's avatar
      Drop balls automatically at game end · 6e64eb8c
      Terence Martin authored
      This new logic detects when all of the gray bricks have finished
      vanishing, and then one by one is selects balls from the maze and
      drops them one last time.
      
      The same drop code is used as for the regular drop, except that in
      this phase the ball is always vanished when it stops moving, even if
      it doesn't hit the goal line.
      
      We move balls from the bottom up so that every ball gets a fair chance
      to move through the maze without being blocked.
      6e64eb8c
  4. 13 Dec, 2016 9 commits
    • Terence Martin's avatar
      Clean up debug code a bit · 45e35481
      Terence Martin authored
      This is just some simple cleanup. Since bricks that are vanished out
      of the maze are reaped now, the code for unhiding them is no longer
      needed since it can't do anything anyway.
      
      This also removes the control from the scene and the documentation.
      
      There are a couple of smaller changes as well in a similar vein.
      45e35481
    • Terence Martin's avatar
      Rearrange method in Maze entity · 61538a2a
      Terence Martin authored
      Shift the setDimensions() method to be under the constructor, since it
      is now responsible for kicking off the level generation that happens
      almost but not quite at construction time.
      61538a2a
    • Terence Martin's avatar
      Implement move tracking and gray brick removal · 18716469
      Terence Martin authored
      Every time a ball has finished moving and either come to rest or
      finished vanishing away, we check to see if there are any balls still
      left to play.
      
      If there are none, we tell all of the gray bricks to vanish. Once this
      happens any balls that move and come to a rest no longer perform this
      check.
      
      All that is left now is to perform the loop whereby we start at the
      bottom right side of the grid and slowly iterate back up and left
      dropping balls and vanishing them when they come to rest, which would
      signal the end of the round.
      18716469
    • Terence Martin's avatar
      Use new API to include entity reaping · c10e5180
      Terence Martin authored
      Implement a new API in the Maze entity that can scan all of the live
      entities in an ActorPool of actors that implement the new interface,
      and find all which are currently hidden and remove them from the maze.
      
      This cleans up the maze content and allows us to stop trying to
      rendering entities which are no longer needed.
      
      For now this only operates over the Ball entities, which means that
      once they reach the bottom of the grid, they vanish and then are
      destroyed once the ball finishes vanishing.
      c10e5180
    • Terence Martin's avatar
      Use the new interface in the Maze entity · d773e101
      Terence Martin authored
      Now that we can easily hide or show a brick or ball, the code in this
      entity is greatly cleaned up by virtue of the fact that it can invoke
      a simple method instead of having to know what animation it should be
      playing.
      d773e101
    • Terence Martin's avatar
      Add new interface to Brick and Ball · 88544e74
      Terence Martin authored
      The Brick and Ball entity classes now implement the new interface. The
      Ball already mostly supported the interface and only needed to have
      the property introduced, while the Brick entity needed the entire
      thing implemented.
      
      This will allow us to easily hide and vanish bricks and balls in a
      generic way without having to go through extra type gymnastics at
      compile time.
      88544e74
    • Terence Martin's avatar
      Add new interface for hideable cells · 3130fae5
      Terence Martin authored
      We add a new interface that provides an API for a MazeCell entity that
      is capable of hiding and restoring itself. The interface includes a
      flag that tells us if the entity is currently hidden or not, along
      with methods to hide and unhide.
      3130fae5
    • Terence Martin's avatar
      Fix rendering order · 332891c4
      Terence Martin authored
      Something I noticed yesterday; we should render balls last so that
      they overlay bonus bricks that are intersected. Otherwise the ball
      seems to visually vanish as it passes through them.
      332891c4
    • Terence Martin's avatar
      Extend ActorList to allow entity list access · 91437fdc
      Terence Martin authored
      ActorList can now give us the live of live or dead entities so that we
      can perform operations on them without using internal methods.
      91437fdc
  5. 12 Dec, 2016 10 commits
    • Terence Martin's avatar
      Change render order of teleports · c5302176
      Terence Martin authored
      Since it is possible for a ball to end up sitting on top of a teleport
      entity unable to move (due to teleporing in and being blocked from
      further travel) we swap the render order of things.
      
      Now teleports render first and balls render after them, so that if
      they  overlay you can see the ball and the faint motion of the black
      hole behind it, instead of just seeing a black hole tha is vaguely
      ball colored in the rotating gap.
      c5302176
    • Terence Martin's avatar
      Fix moving ball rendering · b5ad147c
      Terence Martin authored
      Fix the issue where while the ball is moving if we don't manually draw
      it i, it doesn't render in the proper location. This was an issue only
      because as the ball is dropping, it's screen location is not being
      properly calculated.
      
      This is now fixed, so the manual render is gone.
      b5ad147c
    • Terence Martin's avatar
      Stop balls from blocking vanished balls · fc311cfc
      Terence Martin authored
      As it says on the tin, it's an issue currently that balls remain in
      the maze when they are vanished away, which means that they are
      blocking entities that stop other balls.
      
      This is bad since they only vanish when they reach the goal.
      fc311cfc
    • Terence Martin's avatar
      Render Black Holes again · fb74cfba
      Terence Martin authored
      This is just a simple matter of iterating over the list of known
      destinations for such an entity and rendering it there.
      fb74cfba
    • Terence Martin's avatar
      More rendering refactoring · adf8d20f
      Terence Martin authored
      We have added to the ActorPool the ability to invoke the render method
      on all actors that are still live based on their current position on
      the screen.
      
      Now the maze renders almost everything by first rendering a
      background, then rendering all live entities from pools, and then
      finally markers.
      
      There is still a little bit to be done here; teleports do not render
      yet (they are not in a pool) and the dropping ball is a little visually
      wonky because the ball dropping code does not properly update the
      screen position as the ball is in transit.
      adf8d20f
    • Terence Martin's avatar
      Rendering cleanup; redact previous change · 27b0a344
      Terence Martin authored
      For the next step in the rendering process we have a method that will
      render an entire background of a maze (including the bounding walls)
      before we do anything else.
      
      This means that we (eventually) don't have to actually loop over the
      maze contents to render it (except for markers) although we currently
      still are doing that.
      27b0a344
    • Terence Martin's avatar
      Clean up rendering a bit · 1d0c2ce6
      Terence Martin authored
      We're on track to have the rendering code not require everything that is
      rendered be stored in the maze contents. Along the way is this temporary
      step to keep everything working as expected.
      
      What we have done is removed from Maze the check that causes the code
      to render a background tile underneath entities that are not bricks
      so that they appear properly.
      
      Instead of that, MazeCell now has a boolean flag per instance that
      indicates if this instance has transparency, and the native render
      method will do that on it's own.
      
      This removes some cruft from the rendering code (more to come).
      1d0c2ce6
    • Terence Martin's avatar
      Refactor MazeCell and subclasses · 5391b8d9
      Terence Martin authored
      Instead of every class preloading the sprite sheet, the MazeCell base
      class now does this, to ensure that all cells will be the same
      dimensions and use the same sprite sheet.
      5391b8d9
    • Terence Martin's avatar
      Change super class of Marker · 777518ee
      Terence Martin authored
      Now that this entity is no longer placed directly into the maze grid,
      it does not need to be derived from MazeCell. In fact it technically
      doesn't need to be a class at all, but this makes things a little
      nicer looking in the code.
      777518ee
    • Terence Martin's avatar
      Add noscale option · d04f5789
      Terence Martin authored
      This is mostly for screen capture purposes; if the url of the page
      contains a query string of "noscale", scaling of the stage to fit the
      current window is turned off (even in full screen).
      d04f5789