indexing description: "[ movable object ]" date: "$Date$" revision: "$Revision$" deferred class MOVABLE inherit EM_COLLIDABLE rename draw as draw_collidable end EM_SHARED_BITMAP_FACTORY export {NONE} all end feature -- Initialization initialize_image is -- initializes the image do bitmap_factory.create_bitmap_from_image (bitmap_name) bitmap := bitmap_factory.last_bitmap end feature -- Access direction: EM_VECTOR_2D -- the direction in which the movable goes movable: BOOLEAN is True -- if the collidable is movable feature -- Draw draw (a_surface: EM_SURFACE) is -- Draws the image of the movable to the screen require a_surface_not_void: a_surface /= Void do bitmap.set_x_y ((center.x+image_offset.x).floor, (center.y+image_offset.y).floor) bitmap.draw (a_surface) end feature -- Element Change step_forward (delay: INTEGER) is -- go to the next frame do set_center (center + direction * (delay / 1000)) end set_direction (a_direction: EM_VECTOR_2D) is -- sets the direction require a_direction_not_void: a_direction /= Void do direction := a_direction ensure direction_set: a_direction = direction end feature {NONE} -- Implementation bitmap_name: STRING is -- the name of the bitmap deferred end bitmap: EM_BITMAP -- the image of the movable image_offset: EM_VECTOR_2D -- image offset to the center invariant invariant_clause: True -- Your invariant here end