day five: platform tiles & inspired special

10 Jun 2025 · Mania devlog

Date: 10.06.2025

Session Duration: 11:00 - 13:15

Progress

  1. One-way Platform Tiles I implemented one-way platform tiles for the game. Player can fall on them, but do not collide with them while jumping. They have their own texture (currently no other tile has textures, everything is just rectangles). Currently, the implementation is quite simple. I allow a small offset so that the player doesn't fall through the platform.
if player.vel.y >= 0 && player.pos.y + PLAYER_SIZE.y <= tile.pos.y + PASSABLE_PLATFORM_THRESHOLD {
    player.pos.y = tile.pos.y - PLAYER_SIZE.y
    player.vel.y = 0
    player_data.grounded = true
}
  1. Special Action for Inspired Mood This mood represents the excitement and happiness you feel when you're in love. You feel like you have the power to change the world around you. It does two things: perform a dash and create tiles under yourself as you dash in the air. I think it allows for fun platforming mechanics.

Implementation details

I store the starting position (to know when the player should stop dashing and creating tiles)

PlayerStateDashing :: struct {
    start_pos:      Vec2,
    dash_direction: int,
}

Currently, all of the tiles are created at once. But it would be more beautiful if they were created one by one, and with an animation. And the tiles are destroyed if the player's mood changes or if the player dashes for a second time. Inspiration only goes so far.

if input.special && !player_is_dashing(player_data) {
    player.affected_by_gravity = false

    dash_direction := player_data.flipped ? 1 : -1
    player_data.state = PlayerStateDashing {
        start_pos      = player.pos,
        dash_direction = dash_direction,
    }
    player.vel.y = 0
    player_data.num_dashes += 1

    if player_data.num_dashes == 2 {
        player_data.mood = .None
        player_data.num_dashes = 0

        clear_inspired_tiles()
    } else {
        for i in 0 ..< NUM_INSPIRED_TILES {
            platform_pos :=
                player.pos + {f32(i * TILE_SIZE * dash_direction), PLAYER_SIZE.y + 10}
            new_tile := Tile{platform_pos, .InspiredTile, rl.BLUE}
            append(&g_mem.current_level.tiles, new_tile)
        }
    }
}

Notes

Next Steps