| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- EntityContainer = {}
- EntityContainer[ "Player" ] = {
- on_start = function( self )
- local player = entity_manager:get_entity( "Player" )
- entity_manager:set_player_entity( "Player" )
- player:set_solid_radius( 0.3 )
- player:set_solid( true )
- while true do
- local triangle_id = player:get_move_triangle_id()
- if triangle_id == 0 then
- -- remove player control
- entity_manager:unset_player_entity()
- player:set_solid( false )
- -- move to ladder
- player:move_to_position( -1, 0 )
- player:move_sync()
- -- move to up platform 1
- player:set_rotation( 180 )
- player:linear_to_position( -2, 3.5, 3, Entity.DOWN_TO_UP, "Climb" )
- player:linear_sync()
- -- tell something
- -- message:show_text(1, "I runned away!", 100, 100, 130, 25);
- -- script:wait(2);
- -- message:hide(1);
- -- move to jump position
- player:move_to_position( -2, 6 )
- player:move_sync()
- -- jump to platform 2
- player:set_rotation( 90 )
- player:move_auto_animation( false )
- player:play_animation_stop( "Jump" )
- script:wait( 0.5 ) -- wait to start of jump in animation
- player:jump_to_position( 2, 6, 3, 0.567 ) -- triangle 24
- player:jump_sync()
- script:wait( 0.667 ) -- wait to end of animation
- player:move_auto_animation( true )
- -- move to ladder
- player:move_to_position( 2, 3.5 )
- player:move_sync()
- -- tell something
- -- message:show_text(1, "I returned!", 100, 100, 130, 25)
- -- script:wait(2)
- -- message:hide(1)
- -- ladder down
- player:set_rotation( 180 )
- player:linear_to_position( 1, 0, 0, Entity.DOWN_TO_UP, "Climb" )
- player:linear_sync()
- -- return player control
- player:set_solid( true )
- entity_manager:set_player_entity( "Player" )
- end
- script:wait( 0.5 )
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
- EntityContainer[ "Chaser_Slow" ] = {
- on_start = function( self )
- local chaser_slow = entity_manager:get_entity( "Chaser_Slow" )
- local player = entity_manager:get_entity( "Player" )
- chaser_slow:set_move_auto_speed( 0.5 )
- chaser_slow:set_solid_radius( 0.35 )
- chaser_slow:move_auto_animation( false )
- script:wait( 1 )
- while true do
- chaser_slow:set_solid( true )
- chaser_slow:move_to_entity( player )
- chaser_slow:move_sync()
- chaser_slow:set_solid( false )
- script:wait( 5 )
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
- EntityContainer[ "Chasers_Speed1" ] = {
- on_start = function( self )
- local chaser1 = entity_manager:get_entity( "Chasers_Speed1" )
- local player = entity_manager:get_entity( "Player" )
- chaser1:set_move_auto_speed( 3 )
- chaser1:set_solid_radius( 0.15 )
- chaser1:set_solid( true )
- chaser1:move_auto_animation( false )
- script:wait( 1 )
- while true do
- chaser1:set_position( 0, 0.5, 0 )
- chaser1:move_to_entity( player )
- chaser1:move_sync()
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
- EntityContainer[ "Chasers_Speed2" ] = {
- on_start = function( self )
- local chaser2 = entity_manager:get_entity( "Chasers_Speed2" )
- local player = entity_manager:get_entity( "Player" )
- chaser2:set_move_auto_speed( 3 )
- chaser2:set_solid_radius( 0.15 )
- chaser2:set_solid( true )
- chaser2:move_auto_animation( false )
- script:wait( 1 )
- while true do
- chaser2:set_position( -1, 1, 0 )
- chaser2:move_to_entity( player )
- chaser2:move_sync()
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
- EntityContainer[ "Chasers_Speed3" ] = {
- on_start = function( self )
- local chaser3 = entity_manager:get_entity( "Chasers_Speed3" )
- local player = entity_manager:get_entity( "Player" )
- chaser3:set_move_auto_speed( 3 )
- chaser3:set_solid_radius( 0.15 )
- chaser3:set_solid( true )
- chaser3:move_auto_animation( false )
- script:wait( 1 )
- while true do
- chaser3:set_position( 1, 1, 0 )
- chaser3:move_to_entity( player )
- chaser3:move_sync()
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
- EntityContainer[ "Watcher1" ] = {
- on_start = function( self )
- local watcher1 = entity_manager:get_entity( "Watcher1" )
- local player = entity_manager:get_entity( "Player" )
- watcher1:set_move_auto_speed( 1.5 )
- watcher1:set_solid_radius( 0.3 )
- watcher1:set_solid( true )
- script:wait( 1 )
- while true do
- watcher1:turn_to_entity( player, Entity.CLOSEST, 2 )
- watcher1:turn_sync()
- script:wait( 0.5 )
- watcher1:turn_to_direction( 0, Entity.CLOSEST, Entity.SMOOTH, 2 )
- watcher1:turn_sync()
- script:wait( 1 )
- watcher1:move_to_position( 7.5, -6.5 )
- watcher1:move_sync()
- watcher1:turn_to_entity( player, Entity.CLOSEST, 2 )
- watcher1:turn_sync()
- script:wait( 0.5 )
- watcher1:turn_to_direction( 180, Entity.CLOSEST, Entity.SMOOTH, 2 )
- watcher1:turn_sync()
- script:wait( 1 )
- watcher1:move_to_position( 7.5, 1.5 )
- watcher1:move_sync()
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
- EntityContainer[ "Lifter" ] = {
- on_start = function( self )
- local lifter = entity_manager:get_entity( "Lifter" )
- lifter:set_solid( false )
- lifter:offset_to_position( 0, 0, 3, Entity.NONE, 0 )
- while true do
- script:wait( 1 )
- lifter:offset_to_position( 0, 0, 0, Entity.SMOOTH, 5 )
- lifter:offset_sync()
- script:wait( 1 )
- lifter:offset_to_position( 0, 0, 3, Entity.SMOOTH, 5 )
- lifter:offset_sync()
- end
- return 0
- end,
- on_collide = function( self )
- return 0
- end,
- }
|