local bye_spirit = false;
local move_begin = false;
local energy_is_off = false;
function ActionsJump ()
    
end;
kapec="Kapec ne prishel";
function gameinput (sender,obj_id,attachedID)


    WriteToConsole(kapec.."\n");
    
    if sender == 100 then
      if jumpfromanw then
         jumpfromanw=false
      return;end;     
      if comics12_finished then      
         todevelopers=true
            dev    =true     
            WriteToConsole("Kapec2 \n");
             
         setstatemenu();
            
         WaitRender()
      end;
    return; end;

    if comics12_finished then return end;


    if sender==30 then --комикс завершился
      -- flags.GAMEOVER=true
      -- SaveGame()    

      setstatemenu();    
    
    return;end;    
    
    
    if sender == 15 then
      if obj_id==3 then
          speciale_action(2,4,true,4);
        speciale_action(2,17,true,4);
                StartTimer(5323,5);
      return;end;
      if obj_id == 27 then
        speciale_action(2,18,true);
        StartTimer(5523,6);
      return; end;
      if obj_id == 18 and not energy_is_off then
        speciale_action(2,18,true);
      return; end;
      if obj_id == 15 then

        speciale_action(2,16,true);
      return; end;
      if obj_id == 16 then
      
        speciale_action(2,19,true,4);
        speciale_action(2,20,true,4);
      return; end;
      if obj_id==26 then
                if counter<4 then
                counter=counter+1
                speciale_action(2,26,true,0.5)
          return;end;    
      return;end;      
    return; end;
    
    if sender == 16 then
      if obj_id==39 then
        
      
      
      return;end;
      if obj_id>=36 and obj_id<=38 then
        speciale_action(2,obj_id,true,2)
        speciale_action(2,obj_id+1,true,2)
      return;end;

      if obj_id==26  then
            speciale_action(2,26,true,0.5)        
      return;end;
        
      if obj_id==27 then
      del_object_from_game(3)
      del_object_from_game(5)
      del_object_from_game(7)
      del_object_from_game(4)
      del_object_from_game(6)
      del_object_from_game(11)
      del_object_from_game(9)
      del_object_from_game(12)
      del_object_from_game(13) 
      del_object_from_game(17)
      DeleteResource("comics_f1");
      DeleteResource("comics_f2");
      DeleteResource("comics_f3");
      DeleteResource("comics_f4");
      DeleteResource("comics12_text2");


        loadresource("data\\21\\50\\2\\comics_f13.png","comics_f13",1)
        addstaticobjecttogame(20,"comics_f13",155,166,"",407,0,339,529); --майкл на стуле старый
        speciale_action(2,20);        
         addstaticobjecttogame(19,"comics_f13",190,169,"",0,0,407,499); --майкл на стуле молодой
        speciale_action(2,19);          
        loadresource("data\\21\\50\\2\\comics_f11.png","comics_f11",1)
        loadresource("data\\21\\50\\2\\comics_f12.png","comics_f12",1)      
        addstaticobjecttogame(15,"comics_f11",475,46 ,"",0,0,372,722); --дух
        speciale_action(2,15);
        addstaticobjecttogame(16,"comics_f11",525,96 ,"",372,0,275,670); --блик духа
        speciale_action(2,16);
        addstaticobjecttogame(18,"comics_f12",19 ,0  ,""); --свечене в комнате
        speciale_action(2,18);
        StartTimer(6023,1)

        speciale_action(4,22);    
        speciale_action(4,20);
        speciale_action(4,19);
        speciale_action(4,18);
        speciale_action(4,16);
        speciale_action(4,15);
        speciale_action(4,14);
        speciale_action(4,1);
      return;end;
      if obj_id == 19 then
        StartTimer(6123,2)
      return; end;
      if obj_id == 16 then
        speciale_action(2,15,true,2);

        StartTimer(5623,2);

      return; end;
      if obj_id == 18 and not energy_is_off then
        speciale_action(2,18,true);
      return; end;
      --пентаграмма

      if not move_begin then
           if obj_id == 7 then
          speciale_action(2,9,true,2);
          speciale_action(2,7,true,1.8);
        return; end;
        if obj_id == 9 then
          speciale_action(2,7,true,2);
          speciale_action(2,9,true,1.8);
        return; end;
      end;
      --------------
      if obj_id == 17 then
        RotateObject(17,0,360,15);
        StartTimer(5123,5); --видно мачеху
        StartTimer(4123,3)
      return; end;
      if obj_id == 5 then
        MoveObjectY(5, 40, 568,4);
        speciale_action(2,5,true,2);
      return; end;
      -- if obj_id == 27 then
      -- DeleteResource("comics_f1");
      -- DeleteResource("comics_f2");
      -- DeleteResource("comics_f3");
      -- DeleteResource("comics_f4");
      -- DeleteResource("comics12_text2");


        -- loadresource("data\\21\\50\\2\\comics_f13.png","comics_f13",1)
        -- addstaticobjecttogame(20,"comics_f13",155,166,"",407,0,339,529); --майкл на стуле старый
        -- speciale_action(2,20);        
         -- addstaticobjecttogame(19,"comics_f13",190,169,"",0,0,407,499); --майкл на стуле молодой
        -- speciale_action(2,19);                
        -- speciale_action(2,22,true,0.5);
        -- speciale_action(2,20,true,0.5);
        -- speciale_action(2,27,true,2);
      -- return; end;
    return; end;
    

    
    if sender == 33 then  
      
    return;end;
    
    if sender == 6 then
      
    return; end;
    
    if sender == 28 then
      if obj_id==13 and not move_begin then
        if r then    
            r=false
            MoveObjectX(13,3,0,0.2)
        else
            r=true
            MoveObjectX(13,0,3,0.2)        
        end;
      return;end;
      if obj_id == 6 then        
        speciale_action(2,5,true);
        speciale_action(2,4,true);
      return; end;
      if obj_id == 5 then
        bye_spirit = true;
        speciale_action(2,11,true);
        MoveObjectY(12,294+568-40,294,5);    
        speciale_action(2,12,true,2)
        speciale_action(2,27,true,1)
        speciale_action(2,50)
        speciale_action(2,51)
        speciale_action(2,52)
        speciale_action(2,53)
        speciale_action(2,54)
        speciale_action(2,55)      
        --speciale_action(2,23,true);    


        loadresource("data\\21\\50\\2\\comics_f14.jpg","comics_f14",1)    

        addstaticobjecttogame(22,"comics_f14",0  ,0  ,""); --бг
        speciale_action(2,22);      

    --    StartTimer(54,1.5);
      return; end;
      if obj_id == 12 and bye_spirit then
        -- speciale_action(2,50)
        -- speciale_action(2,51)
        -- speciale_action(2,52)
        -- speciale_action(2,53)
        -- speciale_action(2,54)
        -- speciale_action(2,55)
        
      return; end;
    return; end;
    
    if sender == 36 then
    if obj_id==987 then
        speciale_action(2,3,true);
        speciale_action(2,17,true);
        speciale_action(2,7,true);
    return;end;
     if obj_id==4123 then
        couner=0
        speciale_action(2,26,true,0.5)
     return;end;
      if obj_id == 5123 then
        speciale_action(2,2,true,4);
        speciale_action(2,3,true,4);

        speciale_action(2,6,true,4);

      return; end;
      if obj_id == 5223 then

      return; end;
      if obj_id == 5323 then
        --speciale_action(2,4,true,2);
        speciale_action(2,11,true);
        move_begin = true;
        set_visible_object(7,false)
        set_visible_object(9,false)
        MoveObjectY(7,298,298+568-40,4);
        MoveObjectY(9,298,298+568-40,4);
        MoveObjectY(6,373,373+568-40,4);
        MoveObjectY(12,294,294+568-40,4);
        -- speciale_action(2,7,true,2);
        -- speciale_action(2,9,true,2);
        speciale_action(2,6,true,2);
        speciale_action(2,12,true,2);
      return; end;
      -- if obj_id == 54 then
        -- speciale_action(2,50)
        -- speciale_action(2,51)
        -- speciale_action(2,52)
        -- speciale_action(2,53)
        -- speciale_action(2,54)
        -- speciale_action(2,55)      
        -- speciale_action(2,23,true);
      -- return; end;
      if obj_id == 5523 then
        energy_is_off = true;
        speciale_action(2,16,true,2);
      return; end;
      if obj_id == 5623 then
        -- loadresource("data\\21\\50\\2\\comics_f16.jpg","comics_f16",1)    
        -- addstaticobjecttogame(35,"comics_f16",-263  ,-140,""); --бг        
        -- speciale_action(2,35)      
    --    ScaleObject(35,1,1.2,1,1024,0)
        speciale_action(2,15,true,5);
        AddParticleToObject(1,"from_duh",520,395);
        MoveEmiter("from_duh",520,395);    
        StartEmiter("from_duh")    
        StartTimer(5723,4);        
      return; end;
      if obj_id == 5723 then
        StopEmiter("from_duh",true)
    
      return; end;      

      if obj_id==6023 then
            speciale_action(2,27,true,2);
            speciale_action(2,22,true,0.5);
            speciale_action(2,20,true,0.5);
      return;end;
      if obj_id==6123 then
       comics12_finished=true
       WaitRender();      
      return;end;
      -- if obj_id==9040 then
            -- loadresource("data\\0\\50\\book1.png","book1",1)    
            -- loadresource("data\\0\\50\\book2.png","book2",1)    
            -- loadresource("data\\0\\50\\book3.png","book3",1)        
            -- addstaticobjecttogame(37,"book2",100,20,"",0,0,790,690);
            -- addstaticobjecttogame(39,"book3",409,294,"",481,0,482,416)
            -- addstaticobjecttogame(38,"book3",409,52,"",0,0,481,658);                
            -- speciale_action(2,37)    
            -- speciale_action(2,38)    
            -- speciale_action(2,39)
            -- addfade(100,1)
            -- speciale_action(4,100)
            -- speciale_action(4,37)
            -- speciale_action(4,38)
            -- speciale_action(4,39)        
            -- speciale_action(4,36)
            -- speciale_action(4,35)            
            -- speciale_action(4,14)
            -- speciale_action(4,1)        
            addfade(1000,1)
            speciale_action(4,1000)    
           speciale_action(2,1000,true,2)            
            -- speciale_action(2,35,true,3)
            -- speciale_action(2,36,true,3)
      -- return;end;
    return; end;
    
    if sender == 1 and not comics12_finished then --кликнули левой кнопкой мыши на активный объект
    WriteToConsole("Kapec \n");
    kapec="Kapec uje  tut";
      comics12_finished=true
      BlockCursor(true)
      WaitRender();
    return;end;

end
function SheetSwitched(nCount)
end;