Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.goof.force

Class EM_GOOF_DIRECTIONAL_GRAVITY


Direct ancestors

EM_GOOF_DIRECTIONAL_FORCE

Creation

Features

Invariants

indexing

description

An EM_GOOF_DIRECTIONAL_FORCE that uses masses in the 'object_dependant_factor'
to represend gravitation in jump and run games.

date

$Date: 2005/10/23 09:39:25 $

revision

$Revision: 1.4 $

class

EM_GOOF_DIRECTIONAL_GRAVITY

inherit

EM_GOOF_DIRECTIONAL_FORCE

create

make (a_force_direction: EM_VECTOR_2D)

-- Make directional force with the direction

require
a_force_direction_not_void: a_force_direction /= void
ensure
force_direction_set: force_direction = a_force_direction

feature {EM_GOOF_FORCE, EM_GOOF_PHYSICS} -- Initialization

make (a_force_direction: EM_VECTOR_2D)

-- Make directional force with the direction

require
a_force_direction_not_void: a_force_direction /= void
ensure
force_direction_set: force_direction = a_force_direction

feature {EM_GOOF_FORCE, EM_GOOF_PHYSICS} -- Processing

is_force_applicable (object: EM_GOOF_PHYSICABLE): BOOLEAN

-- Does the force apply to this object

-- (From EM_GOOF_UNARY_FORCE)

require
object_not_void: object /= void
object_dependant_factor (object: EM_GOOF_PHYSICABLE): DOUBLE

-- Object dependant factor in the force equasion (mass in case of gravity)

-- (From EM_GOOF_DIRECTIONAL_FORCE)

require
is_object: object /= void
process (objects: DS_LINKED_LIST[EM_GOOF_OBJECT])

-- Apply force to all physicables

-- (From EM_GOOF_FORCE)

require
is_objects: objects /= void
process_object (object: EM_GOOF_PHYSICABLE)

-- Apply force to this object

-- (From EM_GOOF_UNARY_FORCE)

require
object_not_void: object /= void

feature {EM_GOOF_FORCE, EM_GOOF_PHYSICS} -- Properties

force_direction: EM_VECTOR_2D

-- Direction in with the directional force pulls

-- (From EM_GOOF_DIRECTIONAL_FORCE)

set_force_direction (a_force_direction: EM_VECTOR_2D)

-- Set force direction

-- (From EM_GOOF_DIRECTIONAL_FORCE)

require
a_force_direction_not_void: a_force_direction /= void
ensure
force_direction_set: force_direction = a_force_direction

invariant

force_direction_not_void: force_direction /= void

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end