Sword & Fortune – WIP – Traps

April 19, 2019
Sword & Fortune

New WIP video bellow shows three new traps – crumbling platforms, falling stalactites and spiked block.

Crumbling platform is new element in game from gameplay point of view as well as from code view. We implemented two new interfaces into code. First one has only one method OnLanded() and it is called when player lands on platform, that implements this interface. Second has single method OnGrounded() and this is called every frame if player is standing on platform.
From rendering point of view, we are using Tiled draw mode, which allows us easily extend platform to needed width. Number of small dirt particles falling of it is based on its width.

Stalactites and spiked block have similar code. Both share the same base class. But they have some slight differences in behavior. Stalactites are randomly shaking to attract player’s attention. When fall on ground, they get broken and disappear in cloud of dust. Spiked block does not disappear, but turns itself into one-way platform and player can walk over it. Both traps have detector, that detects, if player is near to trigger the fall:

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *