Class: RubySketch::ChaseConstraint

Inherits:
Constraint show all
Defined in:
lib/rubysketch/constraint.rb

Overview

Moves a point toward the target every frame.

Instance Method Summary collapse

Methods inherited from Constraint

#active?, #collide=, #collide?, #damping, #damping=, #force, #force=, #remove, #removed?, #spring, #spring=, #sprites

Instance Method Details

#targetPin

Returns the target to chase.

Returns:

  • (Pin)

    the target pin



413
414
415
# File 'lib/rubysketch/constraint.rb', line 413

def target()
  Pin.new nil, pin__: @constraint__.target
end

#target=(target) ⇒ Sprite, ...

Sets the target to chase.

Parameters:

  • target (Sprite, Pin, Vector, Array<Numeric>, nil)

    the center of a sprite, a pin, or a point in the world. nil chases nothing

Returns:



405
406
407
# File 'lib/rubysketch/constraint.rb', line 405

def target=(target)
  @constraint__.target = RubySketch.unwrap__ target
end