class MonsterMaze::Player

Defined in:

monster_maze/player.cr

Constant Summary

AnimationDuration = 42
CollisionRadius = 24
CollisionXOffset = 24
CollisionYOffset = 96
DeadDarkenMin = 63
DeathAnimationDuration = 300.milliseconds
FramesFlamesIdle = 4
FramesIdle = 1
FramesRun = 12
MaxHealth = 100
MonsterFollowRadius = VisibilityRadius - 128
MonsterRadiusColor = SF::Color.new(255, 251, 0, 7)
MonsterRadiusMax = 256
MonsterRadiusMin = 64
Sheet = "./assets/sprites/player.png"
SheetFlamesIdle = "./assets/sprites/flames_idle.png"
SheetFlamesRun = "./assets/sprites/flames_run.png"
Size = 96
Speed = 352
SpriteHeight = 128
SpriteWidth = 96
TorchMaxAlpha = 32
TorchSegmentDuration = 5.seconds
TorchSegments = 8
TorchXOffset = 12
TorchYOffset = 16
VisibilityRadius = 512

Constructors

Instance Method Summary

Instance methods inherited from class MonsterMaze::Movable

collides?(dx, dy, box : Box, box_x, box_y)
collides?(dx, dy, circle : Circle, cx, cy)
collides?(circle : Circle, cx, cy)
collides?(dx, dy, movable : Movable)
collides?(movable : Movable)
collides?
, collision_circle : Circle collision_circle, collision_cx collision_cx, collision_cy collision_cy, collision_radius collision_radius, collision_x collision_x, collision_y collision_y, cx cx, cy cy, draw(window : SF::RenderWindow) draw, dx : Int32 | Float32 dx, dy : Int32 | Float32 dy, jump(x : Float32 | Int32, y : Float32 | Int32) jump, jump_to_tile(row, col) jump_to_tile, move(dx, dy) move, move_with_collidable_tiles(tiles) move_with_collidable_tiles, move_with_level(level_width, level_height) move_with_level, move_with_movables(movables) move_with_movables, moved? : Bool moved?, size size, speed speed, update_movement(frame_time, speed = speed, level_width = 0, level_height = 0, collidable_tiles = [] of TileData, movables = [] of Movable) update_movement, update_with_direction_and_speed(frame_time, speed) update_with_direction_and_speed, x : Int32 | Float32 x, y : Int32 | Float32 y

Constructor methods inherited from class MonsterMaze::Movable

new(row = 0, col = 0) new

Constructor Detail

def self.new(row = 0, col = 0) #

[View source]

Instance Method Detail

def add_animation(sheet, animations, name, frames, loops = true, flip_horizontal = false) #

[View source]
def animations : GSF::Animations #

[View source]
def animations_flame : GSF::Animations #

[View source]
def collision_radius #

[View source]
def collision_x #

[View source]
def collision_y #

[View source]
def cx #

[View source]
def cy #

[View source]
def dead? : Bool #

[View source]
def death_timer : Timer #

[View source]
def die! #

[View source]
def draw(window : SF::RenderWindow) #

[View source]
def draw_circle_from_torch(window, radius, color) #

[View source]
def draw_flame(window) #

[View source]
def draw_health(window) #

[View source]
def draw_monster_follow_radius(window : SF::RenderWindow) #

[View source]
def draw_monster_radius(window : SF::RenderWindow) #

[View source]
def draw_player_borders(window) #

[View source]
def draw_torch_visibility(window : SF::RenderWindow) #

[View source]
def health : Int32 #

[View source]
def init #

[View source]
def init_animations #

[View source]
def jump_to_tile(row, col) #

[View source]
def monster_follow_radius #

[View source]
def monster_radius #

[View source]
def move(dx, dy) #

[View source]
def play_animations #

[View source]
def reset #

[View source]
def size #

[View source]
def speed #

[View source]
def take_damage(damage : Int32) #

[View source]
def torch_cx #

[View source]
def torch_cy #

[View source]
def torch_left_percent #

[View source]
def torch_out? #

[View source]
def torch_refill! #

[View source]
def update(frame_time, keys : Keys, joysticks : Joysticks, level_width, level_height, collidable_tiles : Tiles) #

[View source]
def update_movement_dx_input(keys, joysticks) #

[View source]
def update_movement_dy_input(keys, joysticks) #

[View source]
def update_torch_segements #

[View source]
def visibility_radius #

[View source]