Module: Kawaii

Defined in:
lib/kawaii.rb,
lib/kawaii/game.rb,
lib/kawaii/math.rb,
lib/kawaii/node.rb,
lib/kawaii/intro.rb,
lib/kawaii/scene.rb,
lib/kawaii/camera.rb,
lib/kawaii/entity.rb,
lib/kawaii/errors.rb,
lib/kawaii/command.rb,
lib/kawaii/helpers.rb,
lib/kawaii/vector2.rb,
lib/kawaii/version.rb,
lib/kawaii/tweening.rb,
lib/kawaii/animation.rb,
lib/kawaii/constants.rb,
lib/kawaii/tmx_layer.rb,
lib/kawaii/text_field.rb,
lib/kawaii/node_manager.rb,
lib/kawaii/tmx_tile_map.rb,
lib/kawaii/audio_manager.rb,
lib/kawaii/input_manager.rb,
lib/kawaii/scene_manager.rb,
lib/kawaii/physics_entity.rb,
lib/kawaii/content_manager.rb,
lib/kawaii/physics_manager.rb

Defined Under Namespace

Modules: Math Classes: Animation, AudioManager, Camera, Command, ContentManager, Entity, Game, InputManager, Intro, Node, NodeManager, PhysicsEntity, PhysicsManager, Scene, SceneManager, TextField, TmxLayer, TmxTileMap, Tweening, UnsupportedFormatError, Vector2, WrongTypeError

Constant Summary collapse

VERSION =
"0.1.1"
GRAVITY =
0.00098
DEFAULT_CELL_SIZE =
32
SCENE_TRANSITION_DURATION =
1000

Class Method Summary collapse

Class Method Details

.clerp(min, max, weight) ⇒ Object



7
8
9
10
# File 'lib/kawaii/helpers.rb', line 7

def self.clerp min, max, weight
	weight2 = (1.0 - Math::cos(weight * Math::PI)) / 2.0
	min * (1.0 - weight2) + max * weight2
end

.lerp(min, max, weight) ⇒ Object



3
4
5
# File 'lib/kawaii/helpers.rb', line 3

def self.lerp min, max, weight
	min + (max - min) * weight
end

.smooth_step(y0, y1, y2, y3, mu) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/kawaii/helpers.rb', line 12

def self.smooth_step y0, y1, y2, y3, mu

	mu2 = mu*mu
	a0 = y3 - y2 - y0 + y1
	a1 = y0 - y1 - a0
	a2 = y2 - y0
	a3 = y1

	(a0*mu*mu2+a1*mu2+a2*mu+a3)
end