Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Map

Hierarchy

  • Map

Index

Constructors

constructor

  • new Map(game: any, data: any, name: any, key_name: any, tileset_name: any, physics_names: any, tileset_image_url: any, tileset_json_url: any, physics_jsons_url: any, lazy_load: any, collision_embedded: any, bgm_key: any, bgm_url: any, expected_party_level: any, background_key: any): Map
  • Parameters

    • game: any
    • data: any
    • name: any
    • key_name: any
    • tileset_name: any
    • physics_names: any
    • tileset_image_url: any
    • tileset_json_url: any
    • physics_jsons_url: any
    • lazy_load: any
    • collision_embedded: any
    • bgm_key: any
    • bgm_url: any
    • expected_party_level: any
    • background_key: any

    Returns Map

Properties

Private _background_key

_background_key: string

Private _collision_layer

_collision_layer: number

Private _collision_layers_number

_collision_layers_number: number

Private _collision_sprite

_collision_sprite: Sprite

Private _color_filter

_color_filter: any

Private _events

_events: {}

Type declaration

Private _interactable_objects

_interactable_objects: InteractableObjects[]

Private _is_world_map

_is_world_map: boolean

Private _key_name

_key_name: string

Private _lazy_load

_lazy_load: boolean

Private _name

_name: string

Private _npcs

_npcs: NPC[]

Private _show_footsteps

_show_footsteps: boolean

Private _sprite

_sprite: Tilemap

Private assets_loaded

assets_loaded: boolean

Private bgm_key

bgm_key: string

Private bgm_url

bgm_url: string

Private collision_embedded

collision_embedded: boolean

Private data

data: GoldenSun

Private encounter_cumulator

encounter_cumulator: number

Private encounter_zones

encounter_zones: { base_rate: number; parties: string[]; rectangle: Rectangle }[]

Private expected_party_level

expected_party_level: number

Private game

game: Game

Private mode7_filter

mode7_filter: any

Private physics_jsons_url

physics_jsons_url: string

Private physics_names

physics_names: string

Private tileset_image_url

tileset_image_url: string

Private tileset_json_url

tileset_json_url: string

Private tileset_name

tileset_name: string

Static Private Readonly CAMERA_ROTATION_STEP

CAMERA_ROTATION_STEP: 0.003 = 0.003

Static Private Readonly MAX_CAMERA_ROTATION

MAX_CAMERA_ROTATION: 0.035 = 0.035

Accessors

background_key

  • get background_key(): string

collision_layer

  • get collision_layer(): number

collision_layers_number

  • get collision_layers_number(): number

collision_sprite

  • get collision_sprite(): Sprite

color_filter

  • get color_filter(): any

events

  • get events(): {}

interactable_objects

is_world_map

  • get is_world_map(): boolean

key_name

  • get key_name(): string

layers

  • get layers(): any[]

lazy_load

  • get lazy_load(): boolean

name

  • get name(): string

npcs

  • get npcs(): NPC[]

show_footsteps

  • get show_footsteps(): boolean

sprite

  • get sprite(): Tilemap

tile_height

  • get tile_height(): any

tile_width

  • get tile_width(): any

Methods

config_all_bodies

  • config_all_bodies(collision_layer: number): void
  • Configs map, npc and interactable objects collision bodies.

    Parameters

    • collision_layer: number

      the collsion layer index.

    Returns void

config_body

  • config_body(collision_layer: number): void
  • Creates and setups the map collision bodies. Collision bodies for maps may come from physics json file or object layers from a Tiled map.

    Parameters

    • collision_layer: number

      the collsion layer index.

    Returns void

Private config_interactable_object

  • config_interactable_object(): void
  • Initializes all the interactable objects of this map.

    Returns void

Private config_layers

  • config_layers(): void
  • Creates and initializes the map layers.

    Returns void

Private config_npc

  • config_npc(): void
  • Initializes all the NPCs of this map.

    Returns void

Private config_world_map

  • config_world_map(): void
  • Initializes some world map custom features of this map in the case it's a world map.

    Returns void

Private create_interactable_object

  • Creates an interactable object.

    Parameters

    • raw_property: string

      the properties of this interactable object still not parsed.

    Returns InteractableObjects

    return the created interactable object.

Private create_npc

  • create_npc(properties: any, not_parsed?: boolean): NPC
  • Creates a NPC.

    Parameters

    • properties: any

      the properties of this NPC, parsed or not.

    • not_parsed: boolean = true

      whether the properties are parsed or not.

    Returns NPC

    returns the created npc.

Private create_tile_event

get_current_tile

  • get_current_tile(controllable_char: ControllableChar, layer?: any[]): Tile | Tile[]
  • Get the tiles that a ControllableChar is over.

    Parameters

    • controllable_char: ControllableChar

      the ControllableChar.

    • Optional layer: any[]

      if this is not specified, it's returned all tiles for the char position.

    Returns Tile | Tile[]

    returns a tile object: Phaser.Tile or Phaser.Tile[] if multiple layers.

Private get_djinn_on_world_map

  • get_djinn_on_world_map(djinn_key: string): any
  • Creates a NPC representing the djinn to be gotten and a game event to get this djinn.

    Parameters

    • djinn_key: string

      the djinn key to be gotten.

    Returns any

    return the fire event function of the DjinnEvent instance created in this function.

get_layer

  • get_layer(name: string): any
  • Get a specific layer.

    Parameters

    • name: string

      the layer name.

    Returns any

    return the layer.

load_map_assets

  • load_map_assets(force_load: boolean, on_complete?: () => void): void
  • Loads the map assets like tileset and background music.

    Parameters

    • force_load: boolean

      if true, forces the loading process to start.

    • Optional on_complete: () => void

      on load complete callback.

        • (): void
        • Returns void

    Returns void

mount_map

  • mount_map(collision_layer: number): Promise<Map>
  • This is the main function of this class. It mounts the map.

    Parameters

    • collision_layer: number

      the initial collision layer.

    Returns Promise<Map>

    returns the mounted map.

pause

  • pause(): { previously_inactive_io: Set<number>; previously_inactive_npc: Set<number>; previously_not_visible_layers: Set<number> }
  • Pauses map activity, like collisions, npc and interactable objects animation etc.

    Returns { previously_inactive_io: Set<number>; previously_inactive_npc: Set<number>; previously_not_visible_layers: Set<number> }

    return the current map state.

    • previously_inactive_io: Set<number>
    • previously_inactive_npc: Set<number>
    • previously_not_visible_layers: Set<number>

remove_event

  • remove_event(location_key: number, event_id: number): void
  • Removes a tile event in a custom location.

    Parameters

    • location_key: number

      the LocationKey of the event.

    • event_id: number

      the id of the event.

    Returns void

reset_layers

  • reset_layers(): void
  • Resets the existing layers. This can be called after changing the collision layer, for instance.

    Returns void

resume

  • resume(previous_state?: { previously_inactive_io: Set<number>; previously_inactive_npc: Set<number>; previously_not_visible_layers: Set<number> }): void
  • Resumes map activity, like collisions, npc and interactable objects animation etc.

    Parameters

    • Optional previous_state: { previously_inactive_io: Set<number>; previously_inactive_npc: Set<number>; previously_not_visible_layers: Set<number> }

      the map state when it was paused.

      • previously_inactive_io: Set<number>
      • previously_inactive_npc: Set<number>
      • previously_not_visible_layers: Set<number>

    Returns void

sort_sprites

  • sort_sprites(): void
  • Sorts the sprites in the GoldenSun.npc_group by y position and collision layer.

    Returns void

Private start_battle_encounter

  • start_battle_encounter(zone_base_rate: number): boolean
  • Calculates whether it's time to start a random battle.

    Parameters

    • zone_base_rate: number

      the encounter finding rate of the current battle zone.

    Returns boolean

    returns true if it's time to start a random battle.

unset_map

  • unset_map(): void
  • Unsets this map.

    Returns void

update

  • update(): void
  • The map update function.

    Returns void

Private update_map_rotation

  • update_map_rotation(): void
  • If it's a world map, rotates the map on hero movement start.

    Returns void

Private zone_check

  • zone_check(): void
  • Checks whether it's time to start a random battle.

    Returns void

Generated using TypeDoc