Class: Camera2

Inherits:
CameraBase show all
Includes:
Movable2
Defined in:
lib/moon/packages/twod/camera2.rb

Overview

2D Point Camera

Instance Attribute Summary collapse

Attributes inherited from CameraBase

#obj, #speed, #ticks, #view

Instance Method Summary collapse

Methods included from Movable2

#adjust_position, #backward, #forward, #left, #movable?, #move, #move_distance, #moveto, #right

Methods included from Moon::Eventable

#allow_event?, #clear_events, #each_listener, #each_typed_listener, filter_from_options, #has_events?, #initialize_eventable, #off, #on, #ppd_ev, #trigger, #typing

Methods inherited from CameraBase

#follow, #screen_to_world, #screen_to_world_reduce, #update, #velocity, #world_to_screen

Methods included from Moon::Transitionable

#key_transition, #remove_transitions, #transition

Methods included from Moon::TransitionHost

#add_transition, #finish_transitions, #remove_transition, #remove_transitions, #update_transitions

Instance Attribute Details

#positionMoon::Vector2

Returns:


8
# File 'lib/moon/packages/twod/camera2.rb', line 8

field :position, type: Moon::Vector2, default: proc{ |t| t.model.new }

#tilesizeMoon::Vector2

Returns:


11
# File 'lib/moon/packages/twod/camera2.rb', line 11

field :tilesize, type: Moon::Vector2, default: proc{ |t| t.model.new(32, 32) }

Instance Method Details

#view_offsetMoon::Vector2

Returns the point offset in a 2D space

Returns:


17
18
19
# File 'lib/moon/packages/twod/camera2.rb', line 17

def view_offset
  @position + @view.position
end