Sha256: a1c785b71197184523cf3e27b47a33994136000cc647879d31f818ee574f839c

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

# SPDX-License-Identifier: MIT
require 'red_bird/camera'
require 'red_bird/stage'

module RedBird::Demo
  require_relative 'controller_move_on_tiles'
  require_relative 'entity_move_on_tiles'
  require_relative 'tile_maps'

  module Stage
    class MoveOnTiles < RedBird::Stage
      def initialize(global_data)
        super(global_data)

        @tile_map = RedBird::Demo::TileMaps.move_on_tiles(
          global_data[:palette])
        RedBird::RelativeEntity.scenario = @tile_map

        @player = Entity::MoveOnTiles.new(32, 64, global_data[:palette])
        @camera = RedBird::Camera.new(@player, @tile_map)

        self.add_entities([@tile_map, @player])
        @interactions = [@camera]
        
        @controller = Controller::MoveOnTiles.new(@player)
        @input_device = RedBird::InputDevice.new(@controller)
      end

      def post_tick
        @interactions.each { |i| i.call }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
red_bird-demo-0.1.0 lib/red_bird/demo/stage_move_on_tiles.rb