
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0  Or InitSprite3D() = 0
  MessageRequester("Error", "Can't open the sprite system", 0)
  End
EndIf
  UsePNGImageDecoder()
  

  If OpenWindow(0, 0, 0, 500, 500, "Выдры.", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
  ButtonGadget(1, 10,  10, 100, 25, "Настройки")
  ButtonGadget(2, 120,  10, 100, 25, "Чат")
  ButtonGadget(3, 230,  10, 100, 25, "Играть")
  ButtonGadget(4, 340,  10, 100, 25, "Выход")
  ;
  ; This is the 'event loop'. All the user actions are processed here.
  ; It's very easy to understand: when an action occurs, the EventID
  ; isn't 0 and we just have to see what have happened...
  ;
   ;xraz=500
   ;yraz=405
  xraz=600
  yraz=486
 ; xraz=800
 ;yraz=600
  ;  xraz=1024
  ;yraz=768

   OpenWindowedScreen(WindowID(0), 10, 70, xraz, yraz, 1, 0, 0)
   
  


 LoadFont (0, "Arial", 10,#PB_Font_Bold)            ; Load Courrier Font, Size 15
 LoadFont (1, "Arial", 15,#PB_Font_Bold)              ; Load Arial Font, Size 30
 LoadFont (2, "Arial", 8) 




  
  
  LoadSprite (1, "gfx/str.png" )
  LoadSprite (2, "gfx/rama.png" )
LoadSprite (3, "fon/1.png" )
LoadSprite (4, "fon/2.png" )
LoadSprite (5, "fon/3.png" )
  LoadSprite (6, "gfx/target.png" )
    LoadSprite (7, "gfx/rama1.png" )
;-----------------------------------непроходимые
LoadSprite (9, "sprite/1.png" )
LoadSprite (10, "sprite/1.png" )
LoadSprite (11, "sprite/2.png" )
LoadSprite (12, "sprite/3.png" )
LoadSprite (13, "sprite/4.png" )
LoadSprite (14, "sprite/5.png" )
LoadSprite (15, "sprite/6.png" )
LoadSprite (16, "sprite/7.png" )
LoadSprite (17, "sprite/8.png" )
LoadSprite (18, "sprite/9.png" )
LoadSprite (19, "sprite/10.png" )
LoadSprite (20, "sprite/53.png" )
LoadSprite (21, "sprite/11.png" )
LoadSprite (22, "sprite/12.png" )
LoadSprite (23, "sprite/13.png" )
LoadSprite (24, "sprite/14.png" )
LoadSprite (25, "sprite/15.bmp" )
LoadSprite (26, "sprite/16.bmp" )
LoadSprite (27, "sprite/chest_0000.png" )
LoadSprite (28, "sprite/chest_0001.png" )
LoadSprite (29, "sprite/duplo.png" )
LoadSprite (30, "sprite/77.png" )
LoadSprite (31, "sprite/8b.png" )
LoadSprite (32, "sprite/8bb.png" )
;-----------------------------------проходимые

LoadSprite (50, "sprite/50.png" )
LoadSprite (51, "sprite/51.png" )
LoadSprite (52, "sprite/52.png" )
LoadSprite (53, "sprite/53.png" )
LoadSprite (54, "sprite/54.png" )
LoadSprite (55, "sprite/55.png" )
LoadSprite (56, "sprite/56.png" )
LoadSprite (57, "sprite/57.png" )
LoadSprite (58, "sprite/top_lamp_0000.png" )
LoadSprite (59, "sprite/top_lamp_0001.png" )
LoadSprite (60, "sprite/top_lamp_0002.png" )
LoadSprite (61, "sprite/top_lamp_0003.png" )
LoadSprite (62, "sprite/top_lamp_0004.png" )
LoadSprite (63, "sprite/top_lamp_0005.png" )
LoadSprite (64, "sprite/top_lamp_0006.png" )
LoadSprite (65, "sprite/top_lamp_0007.png" )
LoadSprite (66, "sprite/top_lamp_0008.png" )
LoadSprite (67, "sprite/gem_0000.png" )
LoadSprite (68, "sprite/gem_0001.png" )
LoadSprite (69, "sprite/gem_0002.png" )
LoadSprite (70, "sprite/gem_0003.png" )
LoadSprite (71, "sprite/gem_0004.png" )
LoadSprite (72, "sprite/gem_0005.png" )
LoadSprite (73, "sprite/gem_0006.png" )
LoadSprite (74, "sprite/gem_0007.png" )
LoadSprite (75, "sprite/gem_0008.png" )
LoadSprite (76, "sprite/gem_0009.png" )
LoadSprite (77, "sprite/water3_0000.png" )
LoadSprite (78, "sprite/water3_0001.png" )
LoadSprite (79, "sprite/water3_0002.png" )
LoadSprite (80, "sprite/water3_0003.png" )
LoadSprite (81, "sprite/water3_0004.png" )
LoadSprite (82, "sprite/water3_0005.png" )
LoadSprite (83, "sprite/water3_0006.png" )

LoadSprite (84, "sprite/fence_0010.png" )
LoadSprite (85, "sprite/fence_0011.png" )
LoadSprite (86, "sprite/fence_0012.png" )
LoadSprite (87, "sprite/fence_0013.png" )
LoadSprite (88, "sprite/fence_0014.png" )
LoadSprite (89, "sprite/fence_0015.png" )
LoadSprite (90, "sprite/fence_0016.png" )
LoadSprite (91, "sprite/fence_0017.png" )
LoadSprite (92, "sprite/barrell0000.png" )
LoadSprite (93, "sprite/barrell0001.png" )
LoadSprite (94, "sprite/barrell0002.png" )
LoadSprite (95, "sprite/barrell0001.png" )
  ;-----------------------------------Передний план
LoadSprite (100, "sprite/fence_0000.png" )
LoadSprite (101, "sprite/fence_0001.png" )
LoadSprite (102, "sprite/fence_0002.png" )
LoadSprite (103, "sprite/fence_0003.png" )
LoadSprite (104, "sprite/fence_0004.png" )
LoadSprite (105, "sprite/fence_0005.png" )
LoadSprite (106, "sprite/fence_0006.png" )
LoadSprite (107, "sprite/fence_0007.png" )
;-----------------------------------задний план
LoadSprite (120, "fon/1.png" )
LoadSprite (121, "sprite/63.png" )
LoadSprite (122, "sprite/64.png" )
LoadSprite (123, "sprite/65.png" )
LoadSprite (124, "sprite/66.png" )
LoadSprite (125, "sprite/67.png" )
LoadSprite (126, "sprite/68.png" )
LoadSprite (127, "sprite/69.png" )
LoadSprite (128, "sprite/70.png" )
LoadSprite (129, "sprite/71.png" )
LoadSprite (130, "sprite/72.png" )
LoadSprite (131, "sprite/73.png" )
LoadSprite (132, "sprite/74.png" )
LoadSprite (133, "sprite/75.png" )
LoadSprite (134, "sprite/76.png" )
LoadSprite (200, "sprite/58.png" )
LoadSprite (201, "sprite/59.png" )
LoadSprite (202, "sprite/60.png" )
LoadSprite (203, "sprite/61.png" )
LoadSprite (204, "sprite/62.png" )
LoadSprite (220, "sprite/78.png" );   предметы 
LoadSprite (221, "sprite/79.png" )

LoadSprite (250, "sprite/100.png" )
LoadSprite (251, "sprite/101.png" )
LoadSprite (252, "sprite/102.png" )
LoadSprite (253, "sprite/101.png" )
LoadSprite (254, "sprite/102.png" )
LoadSprite (255, "sprite/101.png" )






LoadSprite (300, "sprite/z1.png",#PB_Sprite_Texture )
LoadSprite (301, "sprite/z2.png",#PB_Sprite_Texture )
LoadSprite (302, "sprite/z3.png",#PB_Sprite_Texture )
LoadSprite (303, "sprite/z4.png",#PB_Sprite_Texture )
LoadSprite (304, "sprite/z5.png",#PB_Sprite_Texture )
LoadSprite (305, "sprite/z6.png",#PB_Sprite_Texture )
LoadSprite (306, "sprite/z7.png",#PB_Sprite_Texture )
LoadSprite (307, "sprite/z8.png",#PB_Sprite_Texture )
LoadSprite (308, "sprite/z7.png",#PB_Sprite_Texture )
LoadSprite (309, "sprite/z6.png",#PB_Sprite_Texture )
LoadSprite (310, "sprite/z5.png",#PB_Sprite_Texture )
LoadSprite (311, "sprite/z4.png",#PB_Sprite_Texture )
LoadSprite (312, "sprite/z3.png",#PB_Sprite_Texture )
LoadSprite (313, "sprite/z2.png",#PB_Sprite_Texture )
LoadSprite (314, "sprite/bah.png",#PB_Sprite_Texture )
LoadSprite (315, "sprite/bah1.png",#PB_Sprite_Texture )
LoadSprite (316, "sprite/bah2.png",#PB_Sprite_Texture )
LoadSprite (317, "sprite/bah3.png",#PB_Sprite_Texture )
LoadSprite (318, "sprite/bah4.png",#PB_Sprite_Texture )
LoadSprite (319, "sprite/bah5.png",#PB_Sprite_Texture )
LoadSprite (320, "sprite/bah6.png",#PB_Sprite_Texture )
LoadSprite (321, "sprite/bahh.png",#PB_Sprite_Texture )
LoadSprite (500, "harak/vudra_walk_0000.png",#PB_Sprite_Texture )
LoadSprite (501, "harak/vudra_walk_0001.png",#PB_Sprite_Texture )
LoadSprite (502, "harak/vudra_walk_0002.png",#PB_Sprite_Texture )
LoadSprite (503, "harak/vudra_walk_0003.png",#PB_Sprite_Texture )
LoadSprite (504, "harak/vudra_walk_0004.png",#PB_Sprite_Texture )
LoadSprite (505, "harak/vudra_walk_0005.png",#PB_Sprite_Texture )
LoadSprite (506, "harak/vudra_walk_0006.png",#PB_Sprite_Texture )
LoadSprite (507, "harak/vudra_walk_0007.png",#PB_Sprite_Texture )
LoadSprite (508, "harak/2/vudra_walk_0000.png",#PB_Sprite_Texture )
LoadSprite (509, "harak/2/vudra_walk_0001.png",#PB_Sprite_Texture )
LoadSprite (510, "harak/2/vudra_walk_0002.png",#PB_Sprite_Texture )
LoadSprite (511, "harak/2/vudra_walk_0003.png",#PB_Sprite_Texture )
LoadSprite (512, "harak/2/vudra_walk_0004.png",#PB_Sprite_Texture )
LoadSprite (513, "harak/2/vudra_walk_0005.png",#PB_Sprite_Texture )
LoadSprite (514, "harak/2/vudra_walk_0006.png",#PB_Sprite_Texture )
LoadSprite (515, "harak/2/vudra_walk_0007.png",#PB_Sprite_Texture )

LoadSprite (516, "harak/vudra_anim_2_shoot_0000.png",#PB_Sprite_Texture )
LoadSprite (517, "harak/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )
LoadSprite (518, "harak/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (519, "harak/vudra_anim_2_shoot_0003.png",#PB_Sprite_Texture )
LoadSprite (520, "harak/vudra_anim_2_shoot_0004.png",#PB_Sprite_Texture )
LoadSprite (521, "harak/vudra_anim_2_shoot_0005.png",#PB_Sprite_Texture )
LoadSprite (522, "harak/vudra_anim_2_shoot_0006.png",#PB_Sprite_Texture )
LoadSprite (523, "harak/vudra_anim_shoot0000.png",#PB_Sprite_Texture )
LoadSprite (524, "harak/vudra_anim_shoot0001.png",#PB_Sprite_Texture )
LoadSprite (525, "harak/vudra_anim_shoot0002.png",#PB_Sprite_Texture )
LoadSprite (526, "harak/vudra_anim_2_shoot_0006.png",#PB_Sprite_Texture )
LoadSprite (527, "harak/vudra_anim_2_shoot_0005.png",#PB_Sprite_Texture )
LoadSprite (528, "harak/vudra_anim_2_shoot_0004.png",#PB_Sprite_Texture )
LoadSprite (529, "harak/vudra_anim_2_shoot_0003.png",#PB_Sprite_Texture )
LoadSprite (530, "harak/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (531, "harak/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )
LoadSprite (532, "harak/2/vudra_anim_2_shoot_0000.png",#PB_Sprite_Texture )
LoadSprite (533, "harak/2/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )
LoadSprite (534, "harak/2/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (535, "harak/2/vudra_anim_2_shoot_0003.png",#PB_Sprite_Texture )
LoadSprite (536, "harak/2/vudra_anim_2_shoot_0004.png",#PB_Sprite_Texture )
LoadSprite (537, "harak/2/vudra_anim_2_shoot_0005.png",#PB_Sprite_Texture )
LoadSprite (538, "harak/2/vudra_anim_2_shoot_0006.png",#PB_Sprite_Texture )
LoadSprite (539, "harak/2/vudra_anim_shoot0000.png",#PB_Sprite_Texture )
LoadSprite (540, "harak/2/vudra_anim_shoot0001.png",#PB_Sprite_Texture )
LoadSprite (541, "harak/2/vudra_anim_shoot0002.png",#PB_Sprite_Texture )
LoadSprite (542, "harak/2/vudra_anim_2_shoot_0006.png",#PB_Sprite_Texture )
LoadSprite (543, "harak/2/vudra_anim_2_shoot_0005.png",#PB_Sprite_Texture )
LoadSprite (544, "harak/2/vudra_anim_2_shoot_0004.png",#PB_Sprite_Texture )
LoadSprite (545, "harak/2/vudra_anim_2_shoot_0003.png",#PB_Sprite_Texture )
LoadSprite (546, "harak/2/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (547, "harak/2/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )
LoadSprite (548, "harak/vudra_die_0000.png",#PB_Sprite_Texture )
LoadSprite (549, "harak/vudra_die_0001.png",#PB_Sprite_Texture )
LoadSprite (550, "harak/vudra_die_0002.png",#PB_Sprite_Texture )
LoadSprite (551, "harak/vudra_die_0002.png",#PB_Sprite_Texture )
LoadSprite (552, "harak/vudra_die_0003.png",#PB_Sprite_Texture )

LoadSprite (556, "harak/2/vudra_die_0000.png",#PB_Sprite_Texture )
LoadSprite (557, "harak/2/vudra_die_0001.png",#PB_Sprite_Texture )
LoadSprite (558, "harak/2/vudra_die_0002.png",#PB_Sprite_Texture )
LoadSprite (559, "harak/2/vudra_die_0002.png",#PB_Sprite_Texture )
LoadSprite (560, "harak/2/vudra_die_0003.png",#PB_Sprite_Texture )


LoadSprite (564, "harak/vudra_anim_2_shoot_0000.png",#PB_Sprite_Texture )
LoadSprite (565, "harak/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )
LoadSprite (566, "harak/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (567, "harak/vudra_anim_2_shoot_up0001.png",#PB_Sprite_Texture )
LoadSprite (568, "harak/vudra_anim_2_shoot_up0002.png",#PB_Sprite_Texture )
LoadSprite (569, "harak/vudra_anim_2_shoot_up0003.png",#PB_Sprite_Texture )
LoadSprite (570, "harak/vudra_anim_2_shoot_up0004.png",#PB_Sprite_Texture )
LoadSprite (571, "harak/vudra_anim_2_shoot_up0003.png",#PB_Sprite_Texture )
LoadSprite (572, "harak/vudra_anim_2_shoot_up0002.png",#PB_Sprite_Texture )
LoadSprite (573, "harak/vudra_anim_2_shoot_up0001.png",#PB_Sprite_Texture )
LoadSprite (574, "harak/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (575, "harak/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )


LoadSprite (576, "harak/2/vudra_anim_2_shoot_0000.png",#PB_Sprite_Texture )
LoadSprite (577, "harak/2/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )
LoadSprite (578, "harak/2/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (579, "harak/2/vudra_anim_2_shoot_up0001.png",#PB_Sprite_Texture )
LoadSprite (580, "harak/2/vudra_anim_2_shoot_up0002.png",#PB_Sprite_Texture )
LoadSprite (581, "harak/2/vudra_anim_2_shoot_up0003.png",#PB_Sprite_Texture )
LoadSprite (582, "harak/2/vudra_anim_2_shoot_up0004.png",#PB_Sprite_Texture )
LoadSprite (583, "harak/2/vudra_anim_2_shoot_up0003.png",#PB_Sprite_Texture )
LoadSprite (584, "harak/2/vudra_anim_2_shoot_up0002.png",#PB_Sprite_Texture )
LoadSprite (585, "harak/2/vudra_anim_2_shoot_up0001.png",#PB_Sprite_Texture )
LoadSprite (586, "harak/2/vudra_anim_2_shoot_0002.png",#PB_Sprite_Texture )
LoadSprite (587, "harak/2/vudra_anim_2_shoot_0001.png",#PB_Sprite_Texture )


LoadSprite (628, "harak/vudra_die_0003.png",#PB_Sprite_Texture )
LoadSprite (629, "harak/vudra_die_0004.png",#PB_Sprite_Texture )
LoadSprite (630, "harak/vudra_die_0005.png",#PB_Sprite_Texture )
LoadSprite (631, "harak/vudra_die_0006.png",#PB_Sprite_Texture )
LoadSprite (632, "harak/2/vudra_die_0003.png",#PB_Sprite_Texture )
LoadSprite (633, "harak/2/vudra_die_0004.png",#PB_Sprite_Texture )
LoadSprite (634, "harak/2/vudra_die_0005.png",#PB_Sprite_Texture )
LoadSprite (635, "harak/2/vudra_die_0006.png",#PB_Sprite_Texture )



 LoadSprite (900, "weapon/1.png" )
 LoadSprite (901, "weapon/2.png" )
 LoadSprite (902, "weapon/3.png" )
 LoadSprite (903, "weapon/4.png" )
 LoadSprite (904, "weapon/5.png" )
 LoadSprite (905, "weapon/6.png" )
 LoadSprite (906, "weapon/7.png" )
  LoadSprite (907, "weapon/9.png" )
    LoadSprite (908, "weapon/8.png" )
    LoadSprite (909, "weapon/10.png" )
    LoadSprite (910, "weapon/11.png" )
     LoadSprite (911, "weapon/12.png" )
        LoadSprite (912, "weapon/13.png" )
         LoadSprite (913, "weapon/heart.png",#PB_Sprite_Texture )
         LoadSprite (914, "weapon/17.png" )
        
  LoadSprite (950, "weapon/dym0.bmp" )
  LoadSprite (950, "weapon/dym0.bmp" )
    LoadSprite (951, "weapon/dym1.bmp" )
      LoadSprite (952, "weapon/dym2.bmp" )
        LoadSprite (953, "weapon/dym3.bmp" )
        LoadSprite (954, "weapon/werh1.png" )
        LoadSprite (955, "weapon/werh2.png" )
        LoadSprite (956, "weapon/werh3.png" )
        LoadSprite (957, "weapon/werh4.png" )
        LoadSprite (958, "weapon/werh5.png" )
        LoadSprite (959, "weapon/werh6.png" )
         LoadSprite (960, "weapon/wniz.bmp" )
           LoadSprite (961, "weapon/1.bmp",#PB_Sprite_Texture )
  LoadSprite (962, "weapon/2.bmp",#PB_Sprite_Texture )
             LoadSprite (963, "weapon/1w.png",#PB_Sprite_Texture )
  LoadSprite (964, "weapon/2w.png",#PB_Sprite_Texture )
  
  
   LoadSprite (970, "weapon/1a.png" )
   LoadSprite (971, "weapon/2a.png" )
   LoadSprite (972, "weapon/3a.png" )
    LoadSprite (973, "weapon/4a.png" )
       LoadSprite (974, "weapon/5a.png" )
        LoadSprite (975, "weapon/6a.png" )
  LoadSprite (976, "weapon/7a.png" )
    LoadSprite (977, "weapon/8a.png" )
    LoadSprite (978, "weapon/9a.png" )
    LoadSprite (979, "weapon/10a.png" )
      LoadSprite (980, "weapon/11a.png" )
  LoadSprite (981, "weapon/12a.png" )
   LoadSprite (982, "weapon/13a.png" )
    LoadSprite (983, "weapon/14a.png" )
  LoadSprite (984, "weapon/15a.png" )
  LoadSprite (985, "weapon/16a.png" )
  LoadSprite (986, "weapon/17a.png" )
  LoadSprite (987, "weapon/18a.png" )
  
  
  LoadSprite (990, "harak/s1.png",#PB_Sprite_Texture )
   LoadSprite (991, "harak/s2.png",#PB_Sprite_Texture )
    LoadSprite (992, "harak/s3.png",#PB_Sprite_Texture )
     LoadSprite (993, "harak/s4.png",#PB_Sprite_Texture )

LoadSprite (1009, "gfx/doska2.png",#PB_Sprite_Texture )
LoadSprite (1010, "gfx/doska.png",#PB_Sprite_Texture )
LoadSprite (1011, "sprite/11.png",#PB_Sprite_Texture )
LoadSprite (1012, "sprite/kras.png",#PB_Sprite_Texture )
   LoadSprite (1013, "weapon/1b.png" ,#PB_Sprite_Texture)
    LoadSprite (1014, "weapon/2b.png" ,#PB_Sprite_Texture)
     LoadSprite (1015, "weapon/3b.png" ,#PB_Sprite_Texture)
      LoadSprite (1016, "weapon/4b.png" ,#PB_Sprite_Texture)
       LoadSprite (1017, "weapon/5b.png" ,#PB_Sprite_Texture)
        LoadSprite (1018, "weapon/6b.png",#PB_Sprite_Texture )
         LoadSprite (1019, "weapon/7b.png" ,#PB_Sprite_Texture)
           LoadSprite (1020, "weapon/9b.png" ,#PB_Sprite_Texture)
            LoadSprite (1021, "weapon/10b.png" ,#PB_Sprite_Texture)
             LoadSprite (1022, "weapon/11b.png" ,#PB_Sprite_Texture)
              LoadSprite (1023, "weapon/12b.png" ,#PB_Sprite_Texture)
               LoadSprite (1024, "weapon/13b.png" ,#PB_Sprite_Texture)
                LoadSprite (1025, "weapon/14b.png" ,#PB_Sprite_Texture)
                 LoadSprite (1026, "weapon/15b.png" ,#PB_Sprite_Texture)
                  LoadSprite (1027, "weapon/16b.png",#PB_Sprite_Texture )

LoadSprite (1500, "weapon/1i.png" )
LoadSprite (1501, "weapon/2i.png" )
LoadSprite (1502, "weapon/3i.png" )
LoadSprite (1503, "weapon/4i.png" )
LoadSprite (1504, "weapon/5i.png" )
LoadSprite (1505, "weapon/6i.png" )
 LoadSprite (2000, "gfx/01.bmp" )
  LoadSprite (2001, "gfx/02.bmp" )
   LoadSprite (2002, "gfx/03.bmp" )
    LoadSprite (2003, "gfx/04.bmp" )
     LoadSprite (2004, "gfx/05.bmp" )
      LoadSprite (2005, "gfx/06.bmp" )
       LoadSprite (2006, "gfx/07.bmp" )
        LoadSprite (2007, "gfx/08.bmp" )
         LoadSprite (2008, "gfx/09.bmp" )
          LoadSprite (2009, "gfx/10.bmp" )
           LoadSprite (2010, "gfx/11.bmp" )
            LoadSprite (2010, "gfx/12.bmp" )


LoadSprite (96, "sprite/0.bmp",#PB_Sprite_Texture )
LoadSprite (97, "sprite/0.bmp",#PB_Sprite_Texture )

CreateSprite3D(1, 300)
CreateSprite3D(2, 301)
CreateSprite3D(3, 302)
CreateSprite3D(4, 303)
CreateSprite3D(5, 304)
CreateSprite3D(6, 305)
CreateSprite3D(7, 306)
CreateSprite3D(8, 307)
CreateSprite3D(9, 308)
CreateSprite3D(10, 309)
CreateSprite3D(11, 310)
CreateSprite3D(12, 311)
CreateSprite3D(13, 312)
CreateSprite3D(14, 313)
CreateSprite3D(15, 314)
CreateSprite3D(16, 315)
CreateSprite3D(17, 316)
CreateSprite3D(18, 317)
CreateSprite3D(19, 318)
CreateSprite3D(20, 319)
CreateSprite3D(21, 320)
CreateSprite3D(22, 320)



CreateSprite3D(500, 500)
CreateSprite3D(501, 501)
CreateSprite3D(502, 502)
CreateSprite3D(503, 503)
CreateSprite3D(504, 504)
CreateSprite3D(505, 505)
CreateSprite3D(506, 506)
CreateSprite3D(507, 507)
CreateSprite3D(508, 508)
CreateSprite3D(509, 509)
CreateSprite3D(510, 510)
CreateSprite3D(511, 511)
CreateSprite3D(512, 512)
CreateSprite3D(513, 513)
CreateSprite3D(514, 514)
CreateSprite3D(515, 515)
CreateSprite3D(913, 913)

CreateSprite3D(961, 961)
CreateSprite3D(962, 962)
CreateSprite3D(963, 963)
CreateSprite3D(964, 964)

CreateSprite3D(990, 990)
CreateSprite3D(991, 991)
CreateSprite3D(992, 992)
CreateSprite3D(993, 993)

CreateSprite3D(1009, 1009)
CreateSprite3D(1010, 1010)
CreateSprite3D(1011, 1011)
CreateSprite3D(1012, 1012)

CreateSprite3D(1013, 1013)
CreateSprite3D(1014, 1014)
CreateSprite3D(1015, 1015)
CreateSprite3D(1016, 1016)
CreateSprite3D(1017, 1017)
CreateSprite3D(1018, 1018)
CreateSprite3D(1019, 1019)
CreateSprite3D(1020, 1020)
CreateSprite3D(1021, 1021)
CreateSprite3D(1022, 1022)
CreateSprite3D(1023, 1023)
CreateSprite3D(1024, 1024)
CreateSprite3D(1025, 1025)
CreateSprite3D(1026, 1026)
CreateSprite3D(1027, 1027)

exitm=1
a666.f=0
X666.f=0
Y666.f=0
X23666.f=0
Y23666.f=0
xm=0:ym=0; x y mouse
If yraz=768:razmer=16-10:EndIf ; razmer lokacii
If yraz=600:razmer=16:EndIf
If yraz=486:razmer=16+10:EndIf

c=0:d=0
obx=10
chet=0
obx2=0
   xti=0
   yti=0
   
play=1
play2=4
players=4
players2=4
Structure Person
    x.w
    y.w
    x2.w
    y2.w
    nom.w
    swo.w
    swo2.w
    spid.w
    iner.w
    iner2.w
    upal.w
    gravitator.w
    wani.w
    stor.w
    name$ ;    максимум 10 букв
    energ.w
    energ1.w
    energ2.w
    color.l
    smile.l
    smilet.l
    smilet2.l
    zap.f
  EndStructure

  NewList tur.Person ()
  
  
  Structure Person2
    x.w
    y.w
    xx.w
    yy.w
    nom.w
    ani.w
        tim.w
           tim2.w
           pow.w
  EndStructure
NewList tur2.Person2 ()

  Structure Person3;     персональные данные 
    pnom.l
    opyt.l
    money.l
    trafic.w
    trafic2.w
    trafic3.w
    trafic4.w
    trafic5.w
    name$ ;    максимум 10 букв
    energ.w
    energ1.w
    energ2.w
    ataka.w
    reani.w
    gravi.w
    color.l
    metko.w
    slot1.w
    slot2.w
    slot3.w
    slot4.w
    slot5.w
    slot6.w
    slot7.w
    slot8.w
    slot1a.w
    slot2a.w
    slot3a.w
    slot4a.w
       slot1p.w
       slot2p.w
       slot3p.w
       slot4p.w
       slot5p.w
       slot6p.w
       slot7p.w
       slot8p.w
    kakoj.w;  какое оружие активировано
    EndStructure
NewList tur3.Person3 ()


  Structure Person4
    x.w
    y.w
    xx.w
    yy.w
    nom.w
    degr.w
    life.w
  EndStructure
NewList tur4.Person4 ()

  Structure Person5
    x.w
    y.w
    xx.w
    yy.w
    nom.w
    energi.w
    met.w
    met2.w
        met3.w
        met4.w
        zap.f
        ataka.w
        life.w
        hto.w
  EndStructure
NewList tur5.Person5 ()


  Structure Person6
    x.w
    y.w
    xx.w
    yy.w
    nom.w
    degr.w
    life.w
    cwet.w
    cwet2.w
    spr.w
    kris.w
  EndStructure
NewList tur6.Person6 ()

  Structure Person7
    x.w
    y.w
    nom.w
    life.w
    life2.w
    life3.w
  EndStructure
NewList tur7.Person7 ()


  Structure Person8
    x.w
    y.w
    nom.w
    life.w
    plus.w
    rand.w
  EndStructure
NewList tur8.Person8 ()

  iko=10

okno=0

 AddElement( tur3() )
  tur3()\pnom=1
  tur3()\money=0
    tur3()\opyt=0
    tur3()\trafic=64
  tur3()\trafic2=64
     tur3()\trafic3=1
         tur3()\trafic4=1
          tur3()\trafic5=0
           tur3()\name$="Slipa"
        tur3()\energ=64
        tur3()\energ1=0
          tur3()\energ2=0
        tur3()\color=RGB(255,255,100)
    tur3()\slot1=900
    tur3()\slot2=901
    tur3()\slot3=902
    tur3()\slot4=903
    tur3()\slot5=904
    tur3()\slot6=914
    tur3()\slot7=906
    tur3()\slot8=907
    tur3()\slot1a=979
    tur3()\slot2a=980
    tur3()\slot3a=981
    tur3()\slot4a=974
    
    
       tur3()\slot1p=9999
       tur3()\slot2p=100
       tur3()\slot3p=100
       tur3()\slot4p=100
       tur3()\slot5p=100
       tur3()\slot6p=100
       tur3()\slot7p=100
       tur3()\slot8p=100
       
        tur3()\ataka=0
        tur3()\reani=0
        tur3()\gravi=0
       
         AddElement( tur3() )
  tur3()\pnom=2
  tur3()\money=0
    tur3()\opyt=0
    tur3()\trafic=64
  tur3()\trafic2=64
     tur3()\trafic3=1
         tur3()\trafic4=1
          tur3()\trafic5=0
           tur3()\name$="Gipno Jaba"
        tur3()\energ=64
          tur3()\energ1=0
          tur3()\energ2=0
        tur3()\color=RGB(200,200,255) 
    tur3()\slot1=900
    tur3()\slot2=901
    tur3()\slot3=902
    tur3()\slot4=903
    tur3()\slot5=912
    tur3()\slot6=909
    tur3()\slot7=914
    tur3()\slot8=910
    tur3()\slot1a=975
    tur3()\slot2a=976
    tur3()\slot3a=977
    tur3()\slot4a=978

       tur3()\slot1p=9999
       tur3()\slot2p=100
       tur3()\slot3p=66
       tur3()\slot4p=77
       tur3()\slot5p=88
       tur3()\slot6p=99
       tur3()\slot7p=666
       tur3()\slot8p=55
       tur3()\ataka=0
       tur3()\reani=0
     tur3()\gravi=0
     
     
     
     
     
     
              AddElement( tur3() )
  tur3()\pnom=3
  tur3()\money=0
    tur3()\opyt=0
    tur3()\trafic=64
  tur3()\trafic2=64
     tur3()\trafic3=1
         tur3()\trafic4=1
          tur3()\trafic5=0
           tur3()\name$="Gipno Jaba2"
        tur3()\energ=64
          tur3()\energ1=0
          tur3()\energ2=0
        tur3()\color=RGB(200,200,255) 
    tur3()\slot1=900
    tur3()\slot2=901
    tur3()\slot3=902
    tur3()\slot4=903
    tur3()\slot5=912
    tur3()\slot6=909
    tur3()\slot7=914
    tur3()\slot8=910
    tur3()\slot1a=975
    tur3()\slot2a=976
    tur3()\slot3a=977
    tur3()\slot4a=978

       tur3()\slot1p=9999
       tur3()\slot2p=100
       tur3()\slot3p=66
       tur3()\slot4p=77
       tur3()\slot5p=88
       tur3()\slot6p=99
       tur3()\slot7p=666
       tur3()\slot8p=55
       tur3()\ataka=0
       tur3()\reani=0
     tur3()\gravi=0
     
     
                   AddElement( tur3() )
  tur3()\pnom=4
  tur3()\money=0
    tur3()\opyt=0
    tur3()\trafic=64
  tur3()\trafic2=64
     tur3()\trafic3=1
         tur3()\trafic4=1
          tur3()\trafic5=0
           tur3()\name$="Gipno Jaba3"
        tur3()\energ=64
          tur3()\energ1=0
          tur3()\energ2=0
        tur3()\color=RGB(200,0,255) 
    tur3()\slot1=900
    tur3()\slot2=901
    tur3()\slot3=902
    tur3()\slot4=903
    tur3()\slot5=912
    tur3()\slot6=909
    tur3()\slot7=914
    tur3()\slot8=910
    tur3()\slot1a=975
    tur3()\slot2a=976
    tur3()\slot3a=977
    tur3()\slot4a=978

       tur3()\slot1p=9999
       tur3()\slot2p=100
       tur3()\slot3p=66
       tur3()\slot4p=77
       tur3()\slot5p=88
       tur3()\slot6p=99
       tur3()\slot7p=666
       tur3()\slot8p=55
       tur3()\ataka=0
       tur3()\reani=0
     tur3()\gravi=0
     

     
     
     
     
     SetFrameRate(35)
Gosub load:
Gosub instal:
Gosub instalp
ClearScreen (RGB(0, 132, 255))
Gosub animacija

Gosub print2

Gosub gravitacija

Gosub print
Gosub print4
Gosub print3
Gosub textl
If okno=1:Gosub okno:EndIf 
Gosub mouse


FlipBuffers()




  Repeat
  





     Event = WaitWindowEvent()
   

  
    Select EventGadget()
Case 1
If EventType() =  #PB_EventType_LeftClick 
  If  OpenWindow(1, 0, 0, 400, 200, "Сохранить файл", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ExplorerListGadget(0, 10, 10, 380, 180, "C:\Documents and Settings\Администратор\Рабочий стол\снусмумр2\Tur", #PB_Explorer_AlwaysShowSelection )
 Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf 

EndIf 


          Case 4
End 
          Case 3
 If EventType() =  #PB_EventType_LeftClick :  exitm=0: EndIf





EndSelect
  
    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf





StartTime.f = ElapsedMilliseconds()  

If exitm=1:Goto exi:EndIf 


Gosub animacija

Gosub print2

Gosub gravitacija
Gosub teleportkre
Gosub print
Gosub print4
Gosub print3
Gosub pulq
Gosub ogon
Gosub firee
Gosub babah
Gosub textl
Gosub ikon
Gosub mouse

         
      If fyrr>0:fyrr-1:EndIf                          
  ElapsedTime.f = ElapsedMilliseconds()-StartTime.f


 StartDrawing( ScreenOutput())
DrawingFont(FontID(2)) 
DrawText(10,10 , Str(ElapsedTime.f), RGB((0),(0),(0)) )
  StopDrawing() 
FlipBuffers()


ClearScreen (RGB(0, 132, 255))



 exi:

If exitm=0:ReleaseMouse(0):DisableGadget(3, 1):EndIf 
If exitm=1:ReleaseMouse(1):DisableGadget(3, 0):EndIf 


   Until Quit = 1
  
  

    
EndIf

End 

;-------------animstr
animacija:

Return 

















 sozdym:
 AddElement(tur7())

 If tur5()\nom=2 And tur5()\x >tur5()\xx :tur7()\x=tur5()\x-30-Random(10):EndIf 
  If tur5()\nom=2 And tur5()\x <tur5()\xx :tur7()\x=tur5()\x+60+Random(10):EndIf 
  
   If tur5()\nom=4 And tur5()\x >tur5()\xx :tur7()\x=tur5()\x-30-Random(10):EndIf 
  If tur5()\nom=4 And tur5()\x <tur5()\xx :tur7()\x=tur5()\x+25+Random(10):EndIf 
    If tur5()\nom=5:tur7()\x=tur5()\x-10+Random(10):tur7()\y=tur5()\y+60+Random(10):EndIf 
 If tur5()\nom<>5:tur7()\y=tur5()\y-8+Random(16):EndIf 
 tur7()\nom=950
 tur7()\life2=1+Random(4)
  tur7()\life3= tur7()\life2
 tur7()\life=Random(2)

 Return 


ogon:
ResetList( tur7() ) 
While NextElement( tur7())
If tur7()\nom>0:Gosub ogon2:EndIf 
 Wend
Return 

ogon22:
 DisplayTransparentSprite(tur7()\nom,tur7()\x+c,tur7()\y+d)
tur7()\life2-1
If tur7()\life=0:tur7()\y+2:EndIf 
If tur7()\life=1:tur7()\y-2:EndIf 
If tur7()\life2=0:tur7()\life2=tur7()\life3:Goto ogon222:EndIf 
Return 
ogon222:
tur7()\nom+1
If tur7()\nom=954:DeleteElement(tur7()):EndIf 
Return 


ogon2:
If tur7()\nom=>950 And tur7()\nom<=954:Goto ogon22:EndIf 
ResetList( tur() ) 
While NextElement( tur())
 If tur()\nom=96 And SpriteCollision(10, tur()\x-50, tur()\y-30, 10, tur7()\x, tur7()\y):
 DisplayTransparentSprite(tur7()\nom,tur7()\x+c,tur7()\y+d):EndIf 
 
 
 If Random(50)=0:

If tur()\nom=25 And SpriteCollision(10, tur()\x-50, tur()\y-30, 10, tur7()\x, tur7()\y):: 

rwzr=10
wzr=1
radi=10
xwz=tur7()\x+20
ywz=tur7()\y
Gosub wzrywww:
Goto wendd:EndIf 
EndIf 
 
If Random(500)=0:
    If tur()\nom=23 And SpriteCollision(10, tur()\x-50, tur()\y-30, 10, tur7()\x, tur7()\y):
  DeleteElement(tur())
  Goto wendd
:EndIf 
   If tur()\nom=24 And SpriteCollision(10, tur()\x-50, tur()\y-30, 10, tur7()\x, tur7()\y):
   DeleteElement(tur())
   Goto wendd
 EndIf 
 
  If tur()\nom=21 And SpriteCollision(10, tur()\x-50, tur()\y-30, 10, tur7()\x, tur7()\y):
  tur()\nom=23
:EndIf 
   If tur()\nom=22 And SpriteCollision(10, tur()\x-50, tur()\y-30, 10, tur7()\x, tur7()\y):
  tur()\nom=24
:EndIf 
EndIf 
wendd:
 Wend

tur7()\nom+1
If tur7()\nom=2011:tur7()\nom=2000:EndIf 
tur7()\life-1
If tur7()\life=0:DeleteElement(tur7()):EndIf 
Return 

;------------------всплеск
kris=1013-15:Gosub wzryw2:kris=0:

firee:
ExamineMouse()
If MouseButton(2) And iko=0 And nextpl=0 And ax>0:
;---------------fair
 
ResetList( tur() ) 
While NextElement( tur())
If play=tur()\swo And tur()\wani=25 And tur()\nom=97:Gosub fire2:EndIf 
If play=tur()\swo And tur()\wani<16 And tur()\nom=97:Gosub fire:EndIf 
 Wend
EndIf 
Return 

fire:


If spidf>0:spidf-1:Return:EndIf 
If gravitator<>0 Or tur()\gravitator<>0:Return:EndIf 
If weapon<>910:tur()\wani=16:EndIf 
If weapon=912:tur()\wani=0:EndIf 
If weapon=905 Or weapon=907:tur()\wani=64:EndIf
If weapon=900:wanim=8:EndIf
If weapon=901:wanim=4:EndIf 
If weapon=902:wanim=16:EndIf 
If weapon=903:wanim=10:EndIf
If weapon=904:wanim=10:EndIf
If weapon=905:wanim=12:EndIf
If weapon=906:wanim=12:EndIf
If weapon=907:wanim=12:EndIf
If weapon=908:wanim=12:EndIf
If weapon=909:wanim=10:EndIf
If weapon=914:wanim=16:EndIf



If weapon=910 And stena=0:
wanimx=10
trafic=tur3()\trafic*tur3()\trafic4
If wanimx>trafic+1:
tur()\wani=0:wanim=0
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=990
NextElement(tur())
Return:EndIf
stena=1
EndIf
If weapon=912 And play=tur()\swo And fyrr=0:
fyrr=20
PreviousElement(tur())
a=20
Goto pribaw
EndIf

If weapon=912 Or weapon=910:Return:EndIf 
If Random(100)=0:
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=992
NextElement(tur())
EndIf 

If xm33>tur()\x:tur()\stor=0:EndIf 
If xm33<tur()\x:tur()\stor=1:EndIf 


ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=tur()\swo:

trafic=tur3()\trafic*tur3()\trafic4
If wanim>trafic+1:
tur()\wani=0:wanim=0

PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=990
NextElement(tur())

EndIf 

EndIf 
Wend
Return 

fire2:

If Random(200)=0:
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=992
NextElement(tur())
EndIf 
fire3:

If spidf>0:spidf-1:Return:EndIf
If gravitator<>0 Or tur()\gravitator<>0:Return:EndIf
If weapon<>910:tur()\wani=20:EndIf 
If weapon=905:tur()\wani=64:EndIf
If weapon=900:wanim=8:EndIf
If weapon=901:wanim=4:EndIf 
If weapon=902:wanim=16:EndIf 
If weapon=903:wanim=10:EndIf
If weapon=904:wanim=10:EndIf
If weapon=905:wanim=12:EndIf
If weapon=906:wanim=12:EndIf
If weapon=907:wanim=12:EndIf
If weapon=908:wanim=12:EndIf
If weapon=909:wanim=10:EndIf
If weapon=914:wanim=16:EndIf
If weapon=910 And stena=0:
wanimx=10
trafic=tur3()\trafic*tur3()\trafic4
If wanimx>trafic+1:
tur()\wani=0:wanim=0
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=990
NextElement(tur())
Return:EndIf
stena=1
EndIf
If xm33>tur()\x:tur()\stor=0:EndIf 
If xm33<tur()\x:tur()\stor=1:EndIf 
If weapon=912 Or weapon=910 :Return:EndIf 

ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=tur()\swo:

trafic=tur3()\trafic*tur3()\trafic4
If wanim>trafic+1:
tur()\wani=0:wanim=0
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=990
NextElement(tur())

EndIf 

EndIf 
Wend

Return 
 
 
 minusp:
 ResetList( tur3() ) 
While NextElement( tur3())
If play=tur3()\pnom:
If ax>0:ax-1
If tur3()\kakoj=0:tur3()\slot1p-1:EndIf 
If tur3()\kakoj=32:tur3()\slot2p-1:EndIf 
If tur3()\kakoj=64:tur3()\slot3p-1:EndIf 
If tur3()\kakoj=96:tur3()\slot4p-1:EndIf 
If tur3()\kakoj=128:tur3()\slot5p-1:EndIf 
If tur3()\kakoj=128+32:tur3()\slot6p-1:EndIf
If tur3()\kakoj=128+64:tur3()\slot7p-1:EndIf  
If tur3()\kakoj=128+96:tur3()\slot8p-1:EndIf 
EndIf 
ataka=tur3()\ataka
EndIf 
Wend

 Return 
 
  minuspp:
 ResetList( tur3() ) 
While NextElement( tur3())
If play=tur3()\pnom:
ataka=tur3()\ataka
EndIf 
Wend

 Return 
 
  pulqq3:
    metkoo=0
 Gosub metko
 If ax<=0:Return:EndIf 
  Gosub minusp:
 spidf=1
 AddElement( tur5() )
If tur()\stor=0:tur5()\x=tur()\x+76:EndIf
If tur()\stor=1:tur5()\x=tur()\x:EndIf
If tur()\stor=0:tur5()\xx=0:EndIf 
If tur()\stor=1:tur5()\xx=5000:EndIf 
tur5()\nom=3
tur5()\y=tur()\y+11
tur5()\met=Random(1)+1
tur5()\met2=Random(2)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(16)
tur5()\life=5000
tur5()\ataka=ataka
If Random(metkoo)=0:Return:EndIf 
If Random(metkoo)=0:Return:EndIf 
tur5()\met4=0
 Return 
 


 
    pulqq5:
      If ax<=0:Return:EndIf 
     Gosub minusp:
 spidf=1
 AddElement( tur5() )
 tur5()\life=5000
If tur()\stor=0:tur5()\x=tur()\x+65:EndIf 
If tur()\stor=1:tur5()\x=tur()\x+15:EndIf 
tur5()\yy=-300
tur5()\nom=5
tur5()\y=tur()\y-50
tur5()\met=1+Random(1);storona
tur5()\met2=Random(1)+1;chastota
tur5()\met3=tur5()\met2;
tur5()\met4=Random(3);pixel
tur5()\ataka=ataka
 Return 
 
 
     pulqq6:
      Gosub minusp:
 spidf=1
 AddElement( tur5() )
 tur5()\life=5000
tur5()\x=tur()\x+35
tur5()\yy=3000
tur5()\nom=6
tur5()\y=tur()\y+62
tur5()\met=0;storona
tur5()\met2=Random(1)+1;chastota
tur5()\met3=tur5()\met2;
tur5()\met4=Random(3);pixel
tur5()\ataka=ataka
 Return 
 
      pulqq66:
      If ax<=0:Return:EndIf 
       Gosub minusp:
 spidf=1
 AddElement( tur5() )
 tur5()\life=5000
tur5()\x=tur()\x+35
tur5()\yy=3000
tur5()\nom=8
tur5()\y=tur()\y+72
tur5()\met=Random(1)+1;storona
tur5()\met2=Random(2)+1;chastota
tur5()\met3=tur5()\met2;
tur5()\met4=Random(3);pixel
tur5()\ataka=ataka
 Return 
 
   pulqq4:
    Gosub minusp:
 spidf=1
 AddElement( tur5() )
 tur5()\life=5000
If tur()\stor=0:tur5()\x=tur()\x+76:EndIf
If tur()\stor=1:tur5()\x=tur()\x-10:EndIf
If tur()\stor=0:tur5()\xx=0:EndIf 
If tur()\stor=1:tur5()\xx=5000:EndIf 
tur5()\nom=4
tur5()\y=tur()\y+11
tur5()\zap.f=75+Random(50)
tur5()\ataka=ataka
 Return 
 
 
 
 
 
 

 
  pulqq09:
    metkoo=0
 Gosub metko
   Gosub minusp:
 spidf=0
 AddElement( tur5() )
 tur5()\life=5000
tur5()\ataka=ataka
If tur()\stor=0:tur5()\x=tur()\x+74:EndIf
If tur()\stor=1:tur5()\x=tur()\x:EndIf
If tur()\stor=0:tur5()\xx=0:EndIf 
If tur()\stor=1:tur5()\xx=5000:EndIf 
tur5()\y=tur()\y-12
If tur()\stor=1:tur5()\x=tur()\x-64:EndIf 
If tur()\stor=0:tur5()\x=tur()\x+64:EndIf 

tur5()\nom=10
tur5()\met=Random(1)+1
tur5()\met2=Random(2)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(2)
If Random(metkoo)=0:Return:EndIf 
If Random(metkoo)=0:Return:EndIf 
tur5()\met4=0
 Return 
 
   pulqq099:
    Gosub minusp:
 spidf=0
 AddElement( tur5() )
 tur5()\life=5000
tur5()\ataka=ataka
If tur()\stor=0:tur5()\x=tur()\x+74:EndIf
If tur()\stor=1:tur5()\x=tur()\x:EndIf
If tur()\stor=0:tur5()\xx=0:EndIf 
If tur()\stor=1:tur5()\xx=5000:EndIf 
tur5()\y=tur()\y-12
If tur()\stor=1:tur5()\x=tur()\x-64:EndIf 
If tur()\stor=0:tur5()\x=tur()\x+64:EndIf 
tur5()\nom=11
tur5()\met=Random(1)+1
tur5()\met2=Random(3)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(4)
If Random(metkoo)=0:Return:EndIf 
If Random(metkoo)=0:Return:EndIf 
tur5()\met4=0
 Return 
 
 
 
 metko:
 ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=tur()\swo:
metkoo=tur3()\metko
EndIf 
Wend
 Return 
 
 
 pulqq:
 metkoo=0
 Gosub metko
  Gosub minuspp:
 spidf=0
 AddElement( tur5() )
 tur5()\life=5000
tur5()\ataka=ataka
If tur()\stor=0:tur5()\x=tur()\x+74:EndIf
If tur()\stor=1:tur5()\x=tur()\x:EndIf
If tur()\stor=0:tur5()\xx=0:EndIf 
If tur()\stor=1:tur5()\xx=5000:EndIf 
tur5()\y=tur()\y+11
tur5()\nom=1
tur5()\met=Random(1)+1
tur5()\met2=Random(3)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(10)
If Random(metkoo)=0:Return:EndIf 
If Random(metkoo)=0:Return:EndIf 
tur5()\met4=0
 Return 
 
 
 
 
 razrw:
  metkoo=0
 Gosub metko
  Gosub minusp:
  spidf=2
 AddElement( tur5() )
 tur5()\life=5000
tur5()\ataka=ataka
If tur()\stor=0:tur5()\x=tur()\x+74:EndIf
If tur()\stor=1:tur5()\x=tur()\x-20:EndIf
If tur()\stor=0:tur5()\xx=0:EndIf 
If tur()\stor=1:tur5()\xx=5000:EndIf 
tur5()\y=tur()\y+11
tur5()\nom=2
tur5()\met=Random(1)+1;storona
tur5()\met2=Random(10)+1;chastota
tur5()\met3=tur5()\met2;
tur5()\met4=Random(2)+1;pixel
tur5()\zap=1
If Random(metkoo)=0:Return:EndIf 
If Random(metkoo)=0:Return:EndIf 
tur5()\met4=0
 Return 
moik:
ExamineMouse() 
If MouseButton(1) :
iko=0
spid3=0
gravitator=1
Goto moik
EndIf 
Return 



ognem3:

If Random(10)<9:Return:EndIf 

xwz=tur()\x+48
ywz=tur()\y-30


AddElement(tur7()) 
tur7()\nom=2000
tur7()\x=xwz+Random(150)
tur7()\y=ywz
tur7()\life=1+Random(400)

Return 


ognem4:

If Random(10)<9:Return:EndIf 

xwz=tur()\x-100
ywz=tur()\y-30

AddElement(tur7()) 
tur7()\nom=2000
tur7()\x=xwz-Random(150)
tur7()\y=ywz
tur7()\life=1+Random(400)

Return 


ognem:

 Gosub minusp:
 spidf=0
 AddElement( tur5() )
tur5()\ataka=ataka
If tur()\stor=0:tur5()\x=tur()\x+74:EndIf
If tur()\stor=1:tur5()\x=tur()\x:EndIf
If tur()\stor=0:tur5()\xx=tur()\x-100:EndIf 
If tur()\stor=1:tur5()\xx=tur()\x+100:EndIf 
tur5()\y=tur()\y+11
tur5()\nom=20
tur5()\met=Random(2)
tur5()\met2=Random(3)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(8)
tur5()\life=18


rwzr=1
wzr=50
radi=25
If tur()\stor=0:
xwz=tur()\x+90
ywz=tur()\y
xwzz=tur()\x
ywzz=tur()\y
aaaa.f=0.79
If ym33>tur()\y+40:aaaa.f=1:EndIf 
If ym33<tur()\y-40:aaaa.f=0.6:EndIf 
Gosub instalbb
Gosub ognem3
EndIf 
If tur()\stor=1:
xwz=tur()\x-10
ywz=tur()\y
xwzz=tur()\x
ywzz=tur()\y
aaaa.f=0.79+3.2
If ym33<tur()\y-40:aaaa.f=1+3.2:EndIf 
If ym33>tur()\y+40:aaaa.f=0.6+3.2:EndIf 
Gosub instalbb
Gosub ognem4
EndIf 
Return 


pulq:

ResetList( tur5() ) 
While NextElement( tur5())
If tur5()\nom=>1:Gosub pulq2:EndIf 

Wend
Return 


pulq2:
Start3D()
If tur5()\nom=1:DisplaySprite3D(1 , tur5()\x +c, tur5()\y+d,255):EndIf  
If tur5()\nom=3 :DisplaySprite3D(4 , tur5()\x +c, tur5()\y+d,255):EndIf 
Sprite3DBlendingMode(10, 12)
If tur5()\nom=10 And tur5()\x >tur5()\xx:DisplaySprite3D(961 , tur5()\x +c, tur5()\y+d,255):EndIf 
If tur5()\nom=10 And tur5()\x <tur5()\xx:DisplaySprite3D(962 , tur5()\x +c, tur5()\y+d,255):EndIf 
If tur5()\nom=11 And tur5()\x >tur5()\xx:DisplaySprite3D(963 , tur5()\x +c, tur5()\y+d-10,255):EndIf 
If tur5()\nom=11 And tur5()\x <tur5()\xx:DisplaySprite3D(964 , tur5()\x +c, tur5()\y+d-10,255):EndIf 
Sprite3DBlendingMode(0, 0)

Stop3D()
If tur5()\nom=2 And tur5()\x >tur5()\xx:DisplayTransparentSprite(954+Random(1), tur5()\x +c, tur5()\y+d):EndIf
If tur5()\nom=2 And tur5()\x <tur5()\xx:DisplayTransparentSprite(956+Random(1), tur5()\x +c, tur5()\y+d):EndIf
If tur5()\nom=4: DisplayTransparentSprite(321, tur5()\x +c, tur5()\y+d):EndIf
If tur5()\nom=5:DisplayTransparentSprite(958+Random(1), tur5()\x +c, tur5()\y+d):EndIf
If tur5()\nom=6 Or tur5()\nom=8:DisplayTransparentSprite(960, tur5()\x +c, tur5()\y+d):EndIf
If tur5()\nom<>5:
If tur5()\met=1 And tur5()\met2=0:tur5()\met2=tur5()\met3:tur5()\y-tur5()\met4:EndIf 
If tur5()\met=1:tur5()\met2-1:EndIf 
If tur5()\met=2 And tur5()\met2=0:tur5()\met2=tur5()\met3:tur5()\y+tur5()\met4:EndIf 
If tur5()\met=2:tur5()\met2-1:EndIf 
EndIf 
If tur5()\nom=5:
If tur5()\met=1 And tur5()\met2=0:tur5()\met2=tur5()\met3:tur5()\x-tur5()\met4:EndIf 
If tur5()\met=1:tur5()\met2-1:EndIf 
If tur5()\met=2 And tur5()\met2=0:tur5()\met2=tur5()\met3:tur5()\x+tur5()\met4:EndIf 
If tur5()\met=2:tur5()\met2-1:EndIf 
EndIf 

If tur5()\nom=8:
If tur5()\met=1 And tur5()\met2=0:tur5()\met2=tur5()\met3:tur5()\x-tur5()\met4:EndIf 
If tur5()\met=1:tur5()\met2-1:EndIf 
If tur5()\met=2 And tur5()\met2=0:tur5()\met2=tur5()\met3:tur5()\x+tur5()\met4:EndIf 
If tur5()\met=2:tur5()\met2-1:EndIf 
EndIf 



If tur5()\nom=1 And tur5()\x >tur5()\xx:tur5()\x+16:kuda=0:EndIf 
If tur5()\nom=1 And tur5()\x <tur5()\xx:tur5()\x-16:kuda=1:EndIf  
If tur5()\nom=20 And tur5()\x >tur5()\xx:tur5()\x+16:kuda=0:EndIf 
If tur5()\nom=20 And tur5()\x <tur5()\xx:tur5()\x-16:kuda=1:EndIf 


If tur5()\nom=10 And tur5()\x >tur5()\xx:tur5()\x+40:kuda=0:EndIf 
If tur5()\nom=10 And tur5()\x <tur5()\xx:tur5()\x-40:kuda=1:EndIf  
If tur5()\nom=11 And tur5()\x >tur5()\xx:tur5()\x+40:kuda=0:EndIf 
If tur5()\nom=11 And tur5()\x <tur5()\xx:tur5()\x-40:kuda=1:EndIf  

If tur5()\nom=3 And tur5()\x >tur5()\xx:tur5()\x+16:kuda=0:EndIf 
If tur5()\nom=3 And tur5()\x <tur5()\xx:tur5()\x-16:kuda=1:EndIf 
If tur5()\nom=5:tur5()\y-tur5()\zap:kuda=0:Gosub sozdym:EndIf 
If tur5()\nom=6:tur5()\y+tur5()\zap:kuda=0:EndIf
If tur5()\nom=8:tur5()\y+tur5()\zap:kuda=0:EndIf
If tur5()\nom=4 And tur5()\x >tur5()\xx:kuda=0:tur5()\x+8:Gosub sin:EndIf 
If tur5()\nom=4 And tur5()\x <tur5()\xx:kuda=1:tur5()\x-8:Gosub sin:EndIf 

If tur5()\nom=2 And tur5()\x >tur5()\xx:tur5()\x+tur5()\zap:kuda=0:Gosub sozdym:EndIf 
If tur5()\nom=2 And tur5()\x <tur5()\xx:tur5()\x-tur5()\zap:kuda=1:Gosub sozdym:EndIf 
If tur5()\zap<20:tur5()\zap+1:EndIf 
If tur5()\y>3000:DeleteElement( tur5() ):Return:EndIf 
If tur5()\y<-100:DeleteElement( tur5() ):Return:EndIf 
If tur5()\x<-300:DeleteElement( tur5() ):Return:EndIf 
If tur5()\x>3000:DeleteElement( tur5() ):Return:EndIf 
tur5()\life-1
If tur5()\life=0:DeleteElement( tur5() ):Return:EndIf 


ymd=tur5()\y
xmd=tur5()\x
anal=15

If tur5()\nom=10 Or tur5()\nom=11:anal=0:EndIf 

ResetList( tur() ) 
While NextElement( tur())

 If tur5()\nom=5 And SpritePixelCollision(1, xmd, ymd+20, tur()\nom, tur()\x, tur()\y):kudaa=2:Goto popal:EndIf
 If tur5()\nom=2 And SpritePixelCollision(1, xmd, ymd-anal, tur()\nom, tur()\x, tur()\y):kudaa=4:Goto popal:EndIf
 If SpritePixelCollision(1, xmd, ymd-anal, tur()\nom, tur()\x, tur()\y):kudaa=1:Goto popal:EndIf
 If anal=0 And SpriteCollision(1, xmd, ymd-anal, tur()\nom, tur()\x, tur()\y):kudaa=3:Goto popal:EndIf

 nn:   
Wend
Return 




sin:
X666q.f=10
Y666q.f=10
aaaaq.f=tur5()\zap.f
aaaaq.f+0.4
tur5()\zap.f=aaaaq.f

x23666q.f = X666q*Cos(aaaaq.f) + Y666q*Sin(aaaaq.f)
y23666q.f = X666q*Sin(aaaaq.f) - Y666q*Cos(aaaaq.f)
tur5()\y-y23666q.f
Gosub sozdym
Return 

popal:
ataka=tur5()\ataka
If tur5()\nom=10 Or tur5()\nom=11 Or tur5()\nom=4 Or tur5()\nom=5 Or tur5()\nom=6 Or tur5()\nom=8:Goto nnn:EndIf 
If tur()\nom=17:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=10:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=11:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=12:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=13:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=16:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=18:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=19:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=21:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=22:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=23:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=24:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=25:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf 
If tur()\nom=25:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf
nnn:
If tur()\nom=500:
NextElement(tur())
If kudaa=2:tur()\gravitator=20+Random(130):EndIf 
If kudaa=1:tur()\gravitator=5+Random(10):EndIf 
If kudaa=4:tur()\gravitator=12+Random(10):EndIf 
PreviousElement(tur())
a=0
Gosub otnqtx2
Gosub wzryw:DeleteElement( tur5() ):Return:EndIf; ------------отнял 
Goto nn:


;Сергей слободчиков владимирович серия 0801 434922
;10 10 55 др

;од хаб края хаб раона 15 01 2002 


otnqtx2:
If tur5()\nom=1:a=1:EndIf ; простое ружье
If tur5()\nom=2:a=64:EndIf ; ракетница
If tur5()\nom=20:a=1:EndIf ; огнемет
If tur5()\nom=3:a=4:EndIf ; миниган
If tur5()\nom=4:a=16:EndIf ; плазма
If tur5()\nom=5:a=32:EndIf ; ракета
If tur5()\nom=6:a=32:EndIf ; бобма
If tur5()\nom=8:a=32:EndIf ; 4*бобма
If tur5()\nom=10:a=8:EndIf ; энергооружие
If tur5()\nom=11:a=10:EndIf ; энергооружие2
e=0
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=tur()\swo:e=tur3()\energ2:EndIf 
If tur3()\pnom=tur()\swo
If tur3()\slot1a=982 Or tur3()\slot2a=982 Or tur3()\slot3a=982 Or tur3()\slot4a=982:

If tur5()\nom=10:a=4:EndIf 
If tur5()\nom=11:a=5:EndIf
If tur5()\nom=4:a=8:EndIf

EndIf 
EndIf 
Wend 
otnqtx:;-----------------------minus energijq
If Random(500)=0:
tur()\smilet=255
tur()\smilet2=50
tur()\smile=993
EndIf
a+Random(ataka)
AddElement(tur8())
tur8()\x=tur()\x+50
tur8()\y=tur()\y-10+Random(20)
tur8()\nom=a
tur8()\plus=0
tur8()\rand=Random(9)
ee=e/4
eee=Random(e)

Repeat
If tur()\energ>0 And tur()\energ1<=0:tur()\energ1=ee+eee:tur()\energ-1:EndIf 
If tur()\energ<=0:Goto smertx:EndIf 
tur()\energ1-1
a-1
 Until a=0 
Return 


;---------------smertx

smertx:
If tur()\swo=0:Return:EndIf 
tur()\energ=0
tur()\iner=0
tur()\gravitator=0
tur()\iner2=0
tur()\wani=128
a=tur()\swo
tur()\swo=0
tur()\swo2=a
players2-1
players=players2

NextElement(tur())
tur()\iner=0
tur()\gravitator=0
tur()\iner2=0
PreviousElement(tur())

;ResetList( tur3() ) 
;While NextElement( tur3())

;If tur5()\hto=play:tur3()\opyt+10:EndIf 
;Debug tur5()\hto
;Wend 

If play=a:Goto nextplay:EndIf 
Return 






pribaw:


Repeat
If tur()\energ1=tur()\energ2:tur()\energ+1:tur()\energ1=-1:EndIf 
tur()\energ1+1
If tur()\energ=>64:
tur()\smilet=255
tur()\smilet2=50
tur()\smile=990
Return
:EndIf 
a-1
 Until a=0 
 Gosub minusp:
 kris=913:Gosub wzryw2:kris=0
 wanim=10:
Return 



wzryw:
If tur5()\nom=2 Or tur5()\nom=5 Or tur5()\nom=6 Or tur5()\nom=8:Goto wzryw3:EndIf 
rwzr=10
wzr=1
radi=10
xwz=tur5()\x+20
ywz=tur5()\y
wzrywww:
Gosub instalb
If tur()\nom=21:tur()\nom=23:Return:EndIf 
If tur()\nom=22:tur()\nom=24:Return:EndIf 
If tur()\nom=23:DeleteElement( tur() ):Goto clearr:EndIf 
If tur()\nom=24:DeleteElement( tur() ):Goto clearr:EndIf 
If tur()\nom=25:Gosub wzryw2:DeleteElement( tur() ):Goto clearrr:EndIf 
If tur()\nom=500:
;a=8+ataka
;Gosub otnqtx
EndIf 
NextElement( tur())
If tur()\nom=97:;--------------------энерция попал
If tur()\wani<48:tur()\wani=48:EndIf 
If kuda=0:tur()\iner=4:EndIf 
If kuda=1:tur()\iner2=4:EndIf
If kuda=0 And tur5()\nom=11 :tur()\iner=Random(100)+30:tur()\gravitator=20+Random(120):EndIf 
If kuda=1 And tur5()\nom=11:tur()\iner2=Random(100)+30:tur()\gravitator=20+Random(120):EndIf
tur()\x2=tur()\x
Return:EndIf
Return 




wzryw3:
rwzr=50
wzr=50
radi=12
xwz=tur5()\x+20
ywz=tur5()\y
Gosub instalb
If tur()\nom=21:tur()\nom=23:Return:EndIf 
If tur()\nom=22:tur()\nom=24:Return:EndIf 
If tur()\nom=23:DeleteElement( tur() ):Goto clearr:EndIf 
If tur()\nom=24:DeleteElement( tur() ):Goto clearr:EndIf 
If tur()\nom=25:Gosub wzryw2:DeleteElement( tur() ):Goto clearrr:EndIf 
If tur()\nom=500:
;a=1+ataka
;Gosub otnqtx
EndIf 
NextElement( tur())
If tur()\nom=97:;--------------------энерция попал
If tur()\wani<48:tur()\wani=48:EndIf 
If kuda=0:tur()\iner=16+Random(4):EndIf 
If kuda=1:tur()\iner2=16+Random(4):EndIf
tur()\x2=tur()\x
Return:EndIf
Return 







clearr:
NextElement( tur())
If tur()\nom=96:DeleteElement( tur() ):EndIf 
Return 
clearrr:
NextElement( tur())
If tur()\nom=96:DeleteElement( tur() ):EndIf 
 Gosub inerwzr
Return 

wzryw2:
rwzr=25
wzr=100
radi=15
xwz=tur()\x+20
ywz=tur()\y+20
xwzz=tur()\x
ywzz=tur()\y
Gosub instalb
Return 

inerwzr:
ResetList( tur() ) 
While NextElement( tur())

 If SpriteCollision(tur()\nom, xwzz, ywzz-100, tur()\nom, tur()\x, tur()\y):kudaa=2:Gosub popall:EndIf  
  If SpriteCollision(tur()\nom, xwzz+48, ywzz, tur()\nom, tur()\x, tur()\y):kudaa=0:Gosub popall:EndIf 
   If SpriteCollision(tur()\nom, xwzz-48, ywzz, tur()\nom, tur()\x, tur()\y):kudaa=1:Gosub popall:EndIf 
     If SpriteCollision(tur()\nom, xwzz+96, ywzz, tur()\nom, tur()\x, tur()\y):kudaa=0:Gosub popall:EndIf 
   If SpriteCollision(tur()\nom, xwzz-96, ywzz, tur()\nom, tur()\x, tur()\y):kudaa=1:Gosub popall:EndIf 
        If SpriteCollision(tur()\nom, xwzz+96+48, ywzz, tur()\nom, tur()\x, tur()\y):kudaa=3:Gosub popall:EndIf 
   If SpriteCollision(tur()\nom, xwzz-96-48, ywzz, tur()\nom, tur()\x, tur()\y):kudaa=4:Gosub popall:EndIf 

        If SpriteCollision(tur()\nom, xwzz+48, ywzz-100, tur()\nom, tur()\x, tur()\y):kudaa=5:Gosub popall:EndIf 
   If SpriteCollision(tur()\nom, xwzz-48, ywzz-100, tur()\nom, tur()\x, tur()\y):kudaa=6:Gosub popall:EndIf 
   
           If SpriteCollision(tur()\nom, xwzz+96, ywzz-100, tur()\nom, tur()\x, tur()\y):kudaa=7:Gosub popall:EndIf 
   If SpriteCollision(tur()\nom, xwzz-96, ywzz-100, tur()\nom, tur()\x, tur()\y):kudaa=8:Gosub popall:EndIf 

nnnn:
Wend
Return 
popall: 
If tur()\nom=500:Goto popalll:EndIf 
Return 

popalll:
ResetList( tur3() ) 
While NextElement( tur3())
If tur()\swo=tur3()\pnom:
If tur3()\slot1a=983 Or tur3()\slot2a=983 Or tur3()\slot3a=983 Or tur3()\slot4a=983:
e=tur()\energ2
a=1
ataka=8
Goto otn:
EndIf 
EndIf 
Wend 

e=tur()\energ2
a=64
ataka=64
otn:
Gosub otnqtx

NextElement( tur())
If kudaa=0:tur()\iner=8+Random(48):tur()\gravitator=Random(20):EndIf 
If kudaa=1:tur()\iner2=8+Random(48):tur()\gravitator=Random(20):EndIf
If kudaa=3:tur()\iner=8+Random(8):EndIf 
If kudaa=4:tur()\iner2=8+Random(8):EndIf
If kudaa=2:tur()\iner=8+Random(48):tur()\gravitator=30+Random(130):EndIf
If kudaa=5:tur()\iner2=8+Random(48):tur()\gravitator=30+Random(130):EndIf
If kudaa=2:tur()\iner=8+Random(8):tur()\gravitator=20+Random(30):EndIf
If kudaa=5:tur()\iner2=8+Random(8):tur()\gravitator=20+Random(30):EndIf
tur()\x2=tur()\x

Goto nnnn
Return:






print4:

ResetList( tur() ) 

While NextElement( tur())
If tur()\nom=77:DisplayTransparentSprite( tur()\nom+anim4 , tur()\x + c, tur()\y + d):Goto suu:EndIf 
If tur()\nom=100:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=101:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=102:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=103:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=104:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=105:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=106:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
If tur()\nom=107:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+12):Goto suu:EndIf 
suu:
Wend
Return 


print:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500:Gosub wydra:Goto su:EndIf 
If tur()\nom=>970 And tur()\nom<990:Gosub upastx:EndIf 
If tur()\nom=97 Or tur()\nom=96:Goto su:EndIf 
If tur()\nom=77:Goto su:EndIf 
If tur()\nom=92:DisplayTransparentSprite( tur()\nom+anim5 , tur()\x + c, tur()\y + d):Goto su:EndIf 
If tur()\nom=25:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+8):Goto su:EndIf 
If tur()\nom=26:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+28):Goto su:EndIf 
If tur()\nom=29:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+28):Goto su:EndIf 
If tur()\nom=27:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=28:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=250:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=251:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=252:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=253:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=254:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=255:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=21:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=22:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=23:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=24:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+4):Goto su:EndIf 
If tur()\nom=67:DisplayTransparentSprite( tur()\nom+anim3 , tur()\x + c, tur()\y + d):Goto su:EndIf 
If tur()\nom=58:DisplayTransparentSprite( tur()\nom+anim , tur()\x + c, tur()\y + d):Goto su:EndIf 
 If tur()\nom=19:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+16):Goto su:EndIf 
  If tur()\nom=14:DisplayTransparentSprite( tur()\nom , tur()\x + c+25, tur()\y + d):Goto su:EndIf 
  If tur()\nom=52:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d-30):Goto su:EndIf 
  If tur()\nom=53 Or tur()\nom=54:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d+3):Goto su:EndIf 
  If tur()\nom<=100:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d):EndIf 
    If tur()\nom=>123:DisplayTransparentSprite( tur()\nom , tur()\x + c, tur()\y + d):EndIf 
  su:
  If tur()\nom=251 And tur()\swo=0:tur()\nom=252:tur()\swo=3:EndIf 
  If tur()\nom=251 And  tur()\swo>0:tur()\swo-1:EndIf 
  
  If tur()\nom=252 And tur()\swo=0:tur()\nom=253:tur()\swo=3:EndIf 
  If tur()\nom=252 And  tur()\swo>0:tur()\swo-1:EndIf 
  
  If tur()\nom=253 And tur()\swo=0:tur()\nom=254:tur()\swo=1:EndIf 
  If tur()\nom=253 And  tur()\swo>0:tur()\swo-1:EndIf
  
  If tur()\nom=254 And tur()\swo=0:tur()\nom=255:tur()\swo=1:EndIf 
  If tur()\nom=254 And  tur()\swo>0:tur()\swo-1:EndIf
  
  If tur()\nom=255 And tur()\swo=0:tur()\nom=250:tur()\swo=1:EndIf 
  If tur()\nom=255 And  tur()\swo>0:tur()\swo-1:EndIf
Wend

Return 

print2:

ResetList( tur() ) 

While NextElement( tur())

  If tur()\nom=>120 And tur()\nom<123:DisplayTransparentSprite( tur()\nom , tur()\x + c/2, tur()\y + d):EndIf 
  
Wend

Return 













escc:

exitm=1:
Return 


a222:
ResetList( tur3() ) 
 While NextElement( tur3())
If tur3()\pnom=play:
gr=tur3()\gravi
EndIf 
 Wend 
ResetList( tur() ) 
 While NextElement( tur())
If tur()\nom=97 And tur()\gravitator=0 And tur()\swo=play:
tur()\gravitator=70+gr*2:
EndIf 
Wend
Return 
ece:
xtii=xti
ytii=yti
xtii/32
xtii*32
ytii/32
ytii*32
cc=c
dd=d
cc/32
cc*32
dd/32
dd*32
If cc=xtii And dd=ytii:spid3=0:EndIf  
If cc=xtii And dd-32=ytii:spid3=0:EndIf
If cc=xtii And dd+32=ytii:spid3=0:EndIf
If cc+32=xtii And dd-32=ytii:spid3=0:EndIf
If cc-32=xtii And dd+32=ytii:spid3=0:EndIf
If cc-32=xtii And dd-32=ytii:spid3=0:EndIf
If cc+32=xtii And dd+32=ytii:spid3=0:EndIf

Return 
;--------------------------mouse
mouse:


If iko=0:Gosub prp:EndIf 


ExamineKeyboard()
;push=0
If KeyboardPushed(#PB_Key_Escape):Goto escc:EndIf 
If spid3=1:Goto susus:EndIf 
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=97 And tur()\swo=play And tur()\x<>tur()\x2:Goto susus:EndIf 
Wend 

If KeyboardPushed(#PB_Key_Left) And c<32:c+16:push=1:EndIf  
If KeyboardPushed(#PB_Key_Right) And c>-1048:c-16::push=1:EndIf  
If KeyboardPushed(#PB_Key_Up) And d<0:d+16:push=1:EndIf 
If KeyboardPushed(#PB_Key_Down) And d>-1128:d-16:push=1:EndIf 

If KeyboardPushed(#PB_Key_Return) And iko=0:nextpl=0:mnm=0:Goto nextplay:EndIf 

 
susus:
If spid3=1:spid2=32:spid=32:EndIf 
If push=1:Goto susu:EndIf
Gosub ece
If spid3=0:
c=xti
d=yti

Goto susu
EndIf 
If xti>c And c<128+96:c+spid2:EndIf  
If xti<c And c>-2350:c-spid2::EndIf  
If yti>d And d<0:d+spid::EndIf 
If yti<d And d>-2200:d-spid:EndIf 

susu:
If KeyboardPushed(#PB_Key_Space):
c=xti
d=yti
Gosub a222:space=1:EndIf 






ExamineMouse() 
 
 xm3 = MouseX()                         
 ym3 = MouseY() 
 mnm=0
 If nextpl=1 And xm3>260 And xm3<260+30 And ym3>yraz-yraz/2+30 And ym3<yraz-yraz/2+35+25:mnm=1:EndIf 
 If nextpl=1 And xm3>260+30+10 And xm3<260+30+12+48 And ym3>yraz-yraz/2+30 And ym3<yraz-yraz/2+35+25:mnm=2:EndIf 

 ExamineMouse() 
 If MouseButton(1) And nextpl=1:Goto sss:EndIf 

 
 xm = MouseX()                         
 ym = MouseY() 
 
 xm-c:ym-d
xm/48:xm*48
ym/48:ym*48
xm33=xm
ym33=ym
  xm = MouseX()                         
 ym = MouseY() 

If xm3<340 And ym3>yraz-124:Gosub ikonka:EndIf

DisplayTransparentSprite(1, xm, ym)
anim2+1
anim22+1
If anim2=4:
anim+1
anim3+1
anim4+1
If anim=9:anim=0:EndIf 
If anim4=7:anim4=0:EndIf
If anim3=10:anim3=0:EndIf 
anim2=0
EndIf 
If anim22=10:
anim5+1
If anim5=3:anim5=0:EndIf 
anim22=0
EndIf 

If iko>1:iko-1:EndIf 
ExamineMouse() 
xm-c:ym-d
If MouseButton(1)  And iko=1:
Goto moik
EndIf 

If MouseButton(1)  And spid3=0 And iko=0 And nextpl=0

If xm3<340 And ym3>yraz-124:Return:EndIf

ResetList( tur() ) 

 While NextElement( tur())
 
If tur()\nom=97 And tur()\swo=play:
xm/tur()\spid:xm*tur()\spid
xm33=xm
tur()\x2=xm33:
Return:EndIf 

Wend

EndIf 

ExamineKeyboard()
If KeyboardPushed(#PB_Key_Tab) Or KeyboardPushed(#PB_Key_LeftShift):
c=xti
d=yti
:EndIf
Return 


sss:
 ExamineMouse() 
 If MouseButton(1):Goto sss:EndIf 
 If  mnm=0 And ym3<yraz-60:nextpl=0:EndIf 
 If  mnm=2:nextpl=0:EndIf 
 If  mnm=1 And nextpl=1:nextpl=0:mnm=0:Goto nextplay:EndIf 
 Return 
prp:
If nextpl=1:DisplayTransparentSprite(1010, 200, yraz-yraz/2):
 StartDrawing( ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent )
DrawingFont(FontID(0)) 

DrawText(250,yraz-yraz/2+5 , "Передать ход? ", RGB((255),(200),(100)) )
DrawingFont(FontID(1)) 
DrawText(260,yraz-yraz/2+35 , "Да", RGB((255),(200),(100)) )
DrawText(260+30,yraz-yraz/2+35 , "/", RGB((255),(200),(100)) )
DrawText(260+12+30,yraz-yraz/2+35 , "Нет", RGB((255),(200),(100)) )

DrawingMode(#PB_2DDrawing_XOr )
If mnm=1:DrawText(260,yraz-yraz/2+35 , "Да", RGB((0),(0),(0)) ):EndIf 
If mnm=2:DrawText(260+12+30,yraz-yraz/2+35 , "Нет", RGB((0),(0),(0)) ):EndIf 
  StopDrawing() 

EndIf 


Return 



sdwig:
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=play:
If tur3()\slot1a=0:
tur3()\slot1a=or2a
tur3()\slot2a=0
EndIf 
If tur3()\slot2a=0:
tur3()\slot2a=or3a
tur3()\slot3a=0
EndIf 
If tur3()\slot3a=0:
tur3()\slot3a=or4a
tur3()\slot4a=0
EndIf 
EndIf 
Wend 
Return 

;--------------------wykinx:
wykinx:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=play And tur()\gravitator<>0:Return:EndIf 
Wend 
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=play:
tur3()\slot1a=0:or111=or1a
EndIf 
Wend 
Goto wykin23:
wykinx2:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=play And tur()\gravitator<>0:Return:EndIf 
Wend 
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=play:
tur3()\slot2a=0:or111=or2a
EndIf 
Wend 
Goto wykin23:
wykinx3:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=play And tur()\gravitator<>0:Return:EndIf 
Wend 
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=play:or111=or3a
tur3()\slot3a=0:
EndIf 
Wend 
Goto wykin23:
wykinx4:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=play And tur()\gravitator<>0:Return:EndIf 
Wend 
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=play:or111=or4a
tur3()\slot4a=0:
EndIf 
Wend 
Goto wykin23:



wykin23:
Gosub sdwig
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=play:Goto wykinx22:EndIf 
Wend 
Return 


wykinx22:
If or111=970:tur()\energ2-1:EndIf 
xl=tur()\x
yl=tur()\y
NextElement(tur()) 
AddElement(tur())
tur()\x=xl+32
tur()\y=yl
tur()\y2=37
tur()\nom=or111
aaaa.f=-1
tur()\zap=aaaa.f
Gosub minusa
Return 


upastx:
If tur()\y2>0:
X666q.f=5
Y666q.f=5
aaaaq.f=tur()\zap.f
aaaaq.f+0.1
tur()\zap.f=aaaaq.f
x23666q.f = X666q*Cos(aaaaq.f) + Y666q*Sin(aaaaq.f)
y23666q.f = X666q*Sin(aaaaq.f) - Y666q*Cos(aaaaq.f)
tur()\y2-1:tur()\y+y23666q.f:EndIf 
Return 



ikonka:


oror=0
ExamineMouse() 
If MouseButton(1) And level3=225 And iko=0:level3=0:nextpl=1:Return:EndIf 

If MouseButton(1) And ym3>yraz-124+22+55 And ym3<yraz-124+50+55 And xm3<50-8+32+64+32 And xm3>12:
If or1a>0 And level2=1 And naval=0:Gosub wykinx:EndIf 
If or2a>0 And level2=2 And naval=0:Gosub wykinx2:EndIf 
If or3a>0 And level2=3 And naval=0:Gosub wykinx3:EndIf 
If or4a>0 And level2=4 And naval=0:Gosub wykinx4:EndIf 
naval=1
Goto ikonkaaa:
EndIf 
If or8=0:oror=32:EndIf 
If or7=0:oror=64:EndIf 
If or6=0:oror=96:EndIf 
If or5=0:oror=128:EndIf 
If or4=0:oror=128+32:EndIf 
If or3=0:oror=128+64:EndIf 
If or2=0:oror=128+96:EndIf 

If MouseButton(1) And ym3>yraz-124+22-6 And ym3<yraz-124+52 And xm3<230+14+32-oror And xm3>20:

If or1>0 And level2=0:level=level2:weapon=tur3()\slot1:ax=tur3()\slot1p:EndIf 
If or2>0 And level2=32:level=level2:weapon=tur3()\slot2:ax=tur3()\slot2p:EndIf 
If or3>0 And level2=64:level=level2:weapon=tur3()\slot3:ax=tur3()\slot3p:EndIf 
If or4>0 And level2=96:level=level2:weapon=tur3()\slot4:ax=tur3()\slot4p:EndIf 
If or5>0 And level2=128:level=level2:weapon=tur3()\slot5:ax=tur3()\slot5p:EndIf 
If or6>0 And level2=160:level=level2:weapon=tur3()\slot6:ax=tur3()\slot6p:EndIf 
If or7>0 And level2=192:level=level2:weapon=tur3()\slot7:ax=tur3()\slot7p:EndIf 
If or8>0 And level2=224:level=level2:weapon=tur3()\slot8:ax=tur3()\slot8p:EndIf 

tur3()\kakoj=level2
EndIf 


naval=0
ikonkaaa:

StartDrawing( ScreenOutput())

DrawingMode(#PB_2DDrawing_XOr )
a=0
If or1>0 And xm3=>20 And xm3<50 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(20,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=0:a=tur3()\slot1p:all=tur3()\slot1:Goto oqo:EndIf 
If Or2>0 And xm3=>50 And xm3<82 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(52,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=32:a=tur3()\slot2p:all=tur3()\slot2:Goto oqo:EndIf 
If or3>0 And xm3=>82 And xm3<114 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(84,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=64:a=tur3()\slot3p:all=tur3()\slot3:Goto oqo:EndIf 
If or4>0 And xm3=>114 And xm3<146 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(116,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=96:a=tur3()\slot4p:all=tur3()\slot4:Goto oqo:EndIf 
If or5>0 And xm3=>146 And xm3<178 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(148,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=128:a=tur3()\slot5p:all=tur3()\slot5:Goto oqo:EndIf 
If or6>0 And xm3=>178 And xm3<210 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(170+10,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=160:a=tur3()\slot6p:all=tur3()\slot6:Goto oqo:EndIf 
If or7>0 And xm3=>210 And xm3<242 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(200+12,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=192:a=tur3()\slot7p:all=tur3()\slot7:Goto oqo:EndIf 
If or8>0 And xm3=>242 And xm3<244+35 And ym3>yraz-124+22-6 And ym3<yraz-124+52:Box(230+14,yraz-124+22-6, 30, 30, RGB(0, 0, 0)):level2=224:a=tur3()\slot8p:all=tur3()\slot8:Goto oqo:EndIf 




level3=0
If xm3>244+56 And xm3<244+56+32 And ym3>yraz-124+77 And ym3<yraz-124+77+32:Box(230+14+56,yraz-124+77, 30, 30, RGB(0, 0, 0)):level3=225:EndIf 


If xm3>20-8 And xm3<50-8 And ym3>yraz-124+22+55 And ym3<yraz-124+52+55:Box(12,yraz-124+22+55, 30, 30, RGB(0, 0, 0)):level2=1:Gosub prm1a:EndIf 
If xm3>20-8+32 And xm3<50-8+32 And ym3>yraz-124+22+55 And ym3<yraz-124+52+55:Box(12+32,yraz-124+22+55, 30, 30, RGB(0, 0, 0)):level2=2:Gosub prm2a:EndIf 
If xm3>20-8+64 And xm3<50-8+64 And ym3>yraz-124+22+55 And ym3<yraz-124+52+55:Box(12+64,yraz-124+22+55, 30, 30, RGB(0, 0, 0)):level2=3:Gosub prm3a:EndIf 
If xm3>20-8+32+64 And xm3<50-8+32+64 And ym3>yraz-124+22+55 And ym3<yraz-124+52+55:Box(12+32+64,yraz-124+22+55, 30, 30, RGB(0, 0, 0)):level2=4:Gosub prm4a:EndIf 
StopDrawing() 
Return 
oqo:
If ym3>yraz-124+22-6 And ym3<yraz-124+52 And xm3>20 And xm3<224+54 And all=>900

DrawingFont(FontID(2)) 
DrawingMode(#PB_2DDrawing_Transparent )
b=TextWidth("00000")
bb=TextWidth(Str(a))
bbb=b-bb
DrawText(21+1+level2+bbb, yraz-76+1 , Str(a), RGB((0),(0),(0)) )
DrawText(21+level2+bbb, yraz-76 , Str(a), RGB((180),(180),(180)) )
:EndIf 

StopDrawing() 
Return 
;----------------------артефакты
prm1a:
If or1a=0:Return:EndIf 
DrawingMode(#PB_2DDrawing_Default )
Box(11,yraz-124+22+55-101, 302, 82, RGB(255, 255, 255))
Box(12,yraz-124+22+55-100, 300, 80, RGB(125,125,125))
DrawingMode(  #PB_2DDrawing_Transparent)
If or1a=970:Gosub prm1:EndIf  
If or1a=971:Gosub prm2:EndIf 
If or1a=972:Gosub prm3:EndIf 
If or1a=973:Gosub prm4:EndIf 
If or1a=974:Gosub prm5:EndIf 
If or1a=975:Gosub prm6:EndIf 
If or1a=976:Gosub prm7:EndIf 
If or1a=977:Gosub prm8:EndIf 
If or1a=978:Gosub prm9:EndIf 
If or1a=979:Gosub prm10:EndIf 
If or1a=980:Gosub prm11:EndIf 
If or1a=981:Gosub prm12:EndIf 
If or1a=982:Gosub prm13:EndIf 
If or1a=983:Gosub prm14:EndIf 
If or1a=984:Gosub prm15:EndIf 
If or1a=985:Gosub prm16:EndIf 
If or1a=986:Gosub prm17:EndIf 
If or1a=987:Gosub prm18:EndIf 
DrawingMode(#PB_2DDrawing_XOr )
Return 
prm2a:
If or2a=0:Return:EndIf 
DrawingMode(#PB_2DDrawing_Default )
Box(11,yraz-124+22+55-101, 302, 82, RGB(255, 255, 255))
Box(12,yraz-124+22+55-100, 300, 80, RGB(125,125,125))
DrawingMode(  #PB_2DDrawing_Transparent)
If or2a=970:Gosub prm1:EndIf  
If or2a=971:Gosub prm2:EndIf 
If or2a=972:Gosub prm3:EndIf 
If or2a=973:Gosub prm4:EndIf 
If or2a=974:Gosub prm5:EndIf 
If or2a=975:Gosub prm6:EndIf 
If or2a=976:Gosub prm7:EndIf 
If or2a=977:Gosub prm8:EndIf 
If or2a=978:Gosub prm9:EndIf 
If or2a=979:Gosub prm10:EndIf 
If or2a=980:Gosub prm11:EndIf 
If or2a=981:Gosub prm12:EndIf 
If or2a=982:Gosub prm13:EndIf 
If or2a=983:Gosub prm14:EndIf 
If or2a=984:Gosub prm15:EndIf 
If or2a=985:Gosub prm16:EndIf 
If or2a=986:Gosub prm17:EndIf 
If or2a=987:Gosub prm18:EndIf 
DrawingMode(#PB_2DDrawing_XOr )
Return 
prm3a:
If or3a=0:Return:EndIf 
DrawingMode(#PB_2DDrawing_Default )
Box(11,yraz-124+22+55-101, 302, 82, RGB(255, 255, 255))
Box(12,yraz-124+22+55-100, 300, 80, RGB(125,125,125))
DrawingMode(  #PB_2DDrawing_Transparent)
If or3a=970:Gosub prm1:EndIf  
If or3a=971:Gosub prm2:EndIf 
If or3a=972:Gosub prm3:EndIf
If or3a=973:Gosub prm4:EndIf 
If or3a=974:Gosub prm5:EndIf 
If or3a=975:Gosub prm6:EndIf 
If or3a=976:Gosub prm7:EndIf 
If or3a=977:Gosub prm8:EndIf 
If or3a=978:Gosub prm9:EndIf 
If or3a=979:Gosub prm10:EndIf 
If or3a=980:Gosub prm11:EndIf 
If or3a=981:Gosub prm12:EndIf 
If or3a=982:Gosub prm13:EndIf 
If or3a=983:Gosub prm14:EndIf 
If or3a=984:Gosub prm15:EndIf 
If or3a=985:Gosub prm16:EndIf 
If or3a=986:Gosub prm17:EndIf 
If or3a=987:Gosub prm18:EndIf 
DrawingMode(#PB_2DDrawing_XOr )
Return 
prm4a:
If or4a=0:Return:EndIf 
DrawingMode(#PB_2DDrawing_Default )
Box(11,yraz-124+22+55-101, 302, 82, RGB(255, 255, 255))
Box(12,yraz-124+22+55-100, 300, 80, RGB(125,125,125))
DrawingMode(  #PB_2DDrawing_Transparent)
If or4a=970:Gosub prm1:EndIf  
If or4a=971:Gosub prm2:EndIf 
If or4a=972:Gosub prm3:EndIf 
If or4a=973:Gosub prm4:EndIf 
If or4a=974:Gosub prm5:EndIf 
If or4a=975:Gosub prm6:EndIf 
If or4a=976:Gosub prm7:EndIf 
If or4a=977:Gosub prm8:EndIf 
If or4a=978:Gosub prm9:EndIf 
If or4a=979:Gosub prm10:EndIf 
If or4a=980:Gosub prm11:EndIf 
If or4a=981:Gosub prm12:EndIf 
If or4a=982:Gosub prm13:EndIf 
If or4a=983:Gosub prm14:EndIf 
If or4a=984:Gosub prm15:EndIf 
If or4a=985:Gosub prm16:EndIf 
If or4a=986:Gosub prm17:EndIf 
If or4a=987:Gosub prm18:EndIf 
DrawingMode(#PB_2DDrawing_XOr )
Return 


prm1:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Мухомор.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Выдра становится берсерком.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Броня:", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+48, "Сила:", RGB(0,0,0))
DrawText(20+50,yraz-124+22+55-95+32, "+1", RGB(100,0,0))
DrawText(20+50,yraz-124+22+55-95+48, "+1", RGB(100,0,0))
Return 
prm2:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Волшебная лампа.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Увеличивает богатство.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Добыча кристалов:", RGB(0,0,0))
DrawText(75+80,yraz-124+22+55-95+32, "+4", RGB(100,0,0))
Return 
prm3:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Желтая кровь.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Восстанавливает здоровье.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Здоровье:", RGB(0,0,0))
DrawText(45+50,yraz-124+22+55-95+32, "+1", RGB(100,0,0))
Return 
prm4:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Красная кровь.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Восстанавливает здоровье.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Здоровье:", RGB(0,0,0))
DrawText(45+50,yraz-124+22+55-95+32, "+2", RGB(100,0,0))
Return 
prm5:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Зелье из рыбы.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Повышает прыгучесть.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Гравитация:", RGB(0,0,0))
DrawText(45+60,yraz-124+22+55-95+32, "+3", RGB(100,0,0))
Return 
prm6:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Кошелек.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Увеличивает богатство.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Добыча кристалов:", RGB(0,0,0))
DrawText(75+80,yraz-124+22+55-95+32, "+1", RGB(100,0,0))
Return 
prm7:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Синяя кровь.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Восстанавливает здоровье.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Здоровье:", RGB(0,0,0))
DrawText(45+50,yraz-124+22+55-95+32, "+3", RGB(100,0,0))
Return 
prm8:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Морковь.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Вызывает дух кролика.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Гравитация:", RGB(0,0,0))
DrawText(45+60,yraz-124+22+55-95+32, "+1", RGB(100,0,0))
Return 
prm9:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Болотная жаба.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Вызывает дух болотной жабы.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Гравитация:", RGB(0,0,0))
DrawText(45+60,yraz-124+22+55-95+32, "+5", RGB(100,0,0))
Return 
prm10:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Меч злого хорька.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Повышает злость.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Сила:", RGB(0,0,0))
DrawText(40+20,yraz-124+22+55-95+32, "+3", RGB(100,0,0))
Return 
prm11:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Ящик боеприпасов.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Востонавливает некоторые боеприпасы.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Боеприпасы:", RGB(0,0,0))
DrawText(40+70,yraz-124+22+55-95+32, "+1", RGB(100,0,0))
Return 
prm12:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Наливное яблочко.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Прибавляет выносливости. Освежает.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Ходьба:", RGB(0,0,0))
DrawText(40+40,yraz-124+22+55-95+32, "+1", RGB(100,0,0))
Return 
prm13:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Тухлая рыба.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Повышает имунитет к лучевому оружию.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Имунитет:", RGB(0,0,0))
DrawText(40+50,yraz-124+22+55-95+32, "+2", RGB(100,0,0))
Return 

prm14:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Какашка лисички-фенька.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Вырабатывает имунитет к взрывам.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Имунитет:", RGB(0,0,0))
DrawText(40+50,yraz-124+22+55-95+32, "+3", RGB(100,0,0))
Return 

prm15:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Корона морской выдры.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16-2, "Просветляет.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32-4, "Броня:", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+48-6, "Сила:", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+64-8, "Меткость:", RGB(0,0,0))
DrawText(20+50,yraz-124+22+55-95+32-4, "+2", RGB(100,0,0))
DrawText(20+50,yraz-124+22+55-95+48-6, "+2", RGB(100,0,0))
DrawText(20+70,yraz-124+22+55-95+64-8, "+4", RGB(100,0,0))
Return 

prm16:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Древний доспех.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Делает выдру отважной.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Броня:", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+48, "Сила:", RGB(0,0,0))
DrawText(20+50,yraz-124+22+55-95+32, "+5", RGB(100,0,0))
DrawText(20+50,yraz-124+22+55-95+48, "+2", RGB(100,0,0))
Return 

prm17:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Ботинки.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Повышают выносливость.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Ходьба:", RGB(0,0,0))
DrawText(20+60,yraz-124+22+55-95+32, "+3", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+48, "Гравитация:", RGB(0,0,0))
DrawText(20+85,yraz-124+22+55-95+48, "+1", RGB(100,0,0))
Return 

prm18:
DrawText(20,yraz-124+22+55-95, "Артефакт:", RGB(0,0,0))
DrawText(90,yraz-124+22+55-95, "Кожаный щит.", RGB(100,0,0))
DrawText(20,yraz-124+22+55-95+16, "Увеличивает броню.", RGB(0,0,0))
DrawText(20,yraz-124+22+55-95+32, "Броня:", RGB(0,0,0))
DrawText(20+50,yraz-124+22+55-95+32, "+3", RGB(100,0,0))
Return 

mou:
 ExamineMouse() 
If MouseButton(2) :Goto mou:EndIf 
ResetList( tur() ) 
While NextElement( tur())
 If SpriteCollision(obx, xm3, ym3, tur()\nom, tur()\x, tur()\y): DeleteElement( tur() ):Return:EndIf   
Wend
Return 


sraw:
Return 

























 oknono:
 If okno=1:
 xmz= MouseX()                        
 ymz = MouseY() 
 DisplayTransparentSprite(1, xm, ym)
 
 xmz/48
ymz/48
  If MouseButton(1) 
  If xmz=16 And ymz=0:obx=10:EndIf 
    If xmz=17 And ymz=0:obx=51:EndIf 
    If xmz=18 And ymz=0:obx=50:EndIf 
    If xmz=19 And ymz=0:obx=52:EndIf 
       If xmz=16 And ymz=1:obx=53:EndIf 
            If xmz=17 And ymz=1:obx=58:EndIf 
             If xmz=18 And ymz=1:obx=67:EndIf 
                      If xmz=19 And ymz=1:obx=21:EndIf 
                      If xmz=16 And ymz=2:obx=100:EndIf 
                         If xmz=17 And ymz=2:obx=84:EndIf 
                          If xmz=18 And ymz=2:obx=120:EndIf 
                             If xmz=16 And ymz=3:obx=92:EndIf 
                               If xmz=16 And ymz=4:obx=200:EndIf 
                                 If xmz=17 And ymz=4:obx=220:EndIf 
                                   If xmz=18 And ymz=4:obx=250:EndIf 
           
           
  EndIf 
EndIf 
Return 








w1:
ExamineKeyboard()
If obx=30:obx=49:EndIf 
If KeyboardPushed(#PB_Key_W):Goto w1:EndIf 
obx+1
Return 
s1:
If obx=50:obx=31:EndIf 
ExamineKeyboard()
If KeyboardPushed(#PB_Key_S):Goto s1:EndIf 
If obx>10:obx-1:EndIf 
Return 
 











text:
  StartDrawing( ScreenOutput() )
      DrawingMode(1)
      
      
  
   DrawText(xp, yp, a$, RGB((0),(0),(0)) )

      
   StopDrawing()


Return 


f1:
ExamineKeyboard()
If KeyboardPushed(#PB_Key_F1):Goto f1:EndIf 
If okno=1:okno=0:Return:EndIf 
If okno=0:okno=1:Return:EndIf 
Return 



okno:
 xmm = MouseX()                         
 ymm = MouseY() 
 xmm+48
 xmm/48:xmm*48
ymm/48:ymm*48
  StartDrawing( ScreenOutput() )
      DrawingMode(1)
      Box(800-70,0,256+8,1024+8,RGB((200),(200),(200)))


  If xmm>730 :Box(xmm-48,ymm+16,48,48,RGB((255),(0),(255))):EndIf 

   StopDrawing()
   
   
  DisplayTransparentSprite(10, 768, 16)
  DisplayTransparentSprite(51, 768+48, 16)
  DisplayTransparentSprite(50, 768+48+48, 16)
  DisplayTransparentSprite(52, 768+96+48, 16)
   DisplayTransparentSprite(53, 768, 16+48)
     DisplayTransparentSprite(58, 768+48, 16+48)
          DisplayTransparentSprite(67, 768+48+48, 16+48)
           DisplayTransparentSprite(21, 768+48+48+48, 16+48)
             DisplayTransparentSprite(100, 768, 16+48+48)
                 DisplayTransparentSprite(84, 768+48, 16+48+48)
                  DisplayTransparentSprite(120, 768+48+48, 16+48+48)
                    DisplayTransparentSprite(92, 768, 16+48+48+48)
            
                       DisplayTransparentSprite(200, 768, 16+48+48+48+48)
                       DisplayTransparentSprite(220, 768+48, 16+48+48+48+48)
                        DisplayTransparentSprite(250, 768+48+48, 16+48+48+48+48)
   
   xp=730:yp=550
a$="Hомер обьекта -"
Gosub text
xp=730:yp=560
a$=Str(obx)
Gosub text
Return 







instal:

Gosub instor

ResetList( tur() ) 
While NextElement( tur())



If tur()\nom=30:Gosub instal2:EndIf 

If tur()\nom=10:Gosub instal22:EndIf 

If tur()\nom=09 Or tur()\nom=10 Or tur()\nom=11 Or tur()\nom=19 Or tur()\nom=12 Or tur()\nom=17 Or tur()\nom=13  Or tur()\nom=16  Or tur()\nom=18 Or tur()\nom=21 Or tur()\nom=22 Or tur()\nom=23 Or tur()\nom=24 Or tur()\nom=25:
x=tur()\x
y=tur()\y
  If tur()\nom=25:y+8:EndIf 
 AddElement( tur() )
  tur()\x = x
  tur()\y = y
  tur()\nom = 96
EndIf 




Wend



Return 

instal22:
x=tur()\x
y=tur()\y
If Random(5)=0:Goto ins1:EndIf 
Return 
 ins1:
 *Old_Element3 = @tur()
 LastElement(tur())
AddElement( tur() )
tur()\x = x
tur()\y = y-48
tur()\nom = 67
 ChangeCurrentElement(tur(), *Old_Element3)
Return 


instal2:

xx=tur()\x
yy=tur()\y

aasz=32
Repeat 


  AddElement( tur2() )
  tur2()\x = tur()\x+Random(48)-8
  tur2()\y = tur()\y+16
  tur2()\xx = tur()\x-8
  tur2()\yy = tur()\y+16
  tur2()\nom = 1
  tur2()\ani = 16+Random(128)
  
  tur2()\tim = 0+Random(8)
    tur2()\tim2= tur2()\tim
    tur2()\pow = Random(3)
      If aasz>0:aasz-1:EndIf 
    Until aasz=0
Return 




print3:

Start3D()

ResetList( tur2() ) 

While NextElement( tur2())

  If tur2()\nom>0:
  :DisplaySprite3D( tur2()\nom , tur2()\x + c, tur2()\y + d, tur2()\ani):EndIf 
  
  If tur2()\pow=1 And tur2()\tim/2=0: tur2()\x-1:EndIf
    If tur2()\pow=2 And tur2()\tim/2=0: tur2()\x+1:EndIf
  
If tur2()\tim>0: tur2()\tim-1:EndIf
If tur2()\tim=0: tur2()\tim=tur2()\tim2:tur2()\nom+1:EndIf
If tur2()\nom=14:tur2()\nom=1:EndIf 

  If tur2()\ani>0:tur2()\ani-1:tur2()\y-1:EndIf
     If tur2()\ani=0:xx=tur2()\xx:yy=tur2()\yy:DeleteElement( tur2() ): Gosub soz:EndIf 
Wend

ResetList( tur4() ) 

While NextElement( tur4())
If tur4()\nom>0:
If tur4()\nom>0 And tur4()\nom<9 :DisplaySprite3D( tur4()\nom , tur4()\x + c, tur4()\y + d, tur4()\life*10 ):EndIf 
If tur4()\degr=0:tur4()\x+8:tur4()\life-1:EndIf 
If tur4()\degr=1:tur4()\x+8:tur4()\y+8:tur4()\life-1:EndIf
If tur4()\degr=2:tur4()\y+8:tur4()\life-1:EndIf
If tur4()\degr=3:tur4()\x-8:tur4()\y+8:tur4()\life-1:EndIf
If tur4()\degr=4:tur4()\x-8:tur4()\life-1:EndIf
If tur4()\degr=5:tur4()\x-8:tur4()\y-8:tur4()\life-1:EndIf
If tur4()\degr=6:tur4()\y-8:tur4()\life-1:EndIf
If tur4()\degr=7:tur4()\x+8:tur4()\y-8:tur4()\life-1:EndIf
If tur4()\life=0:DeleteElement(tur4() ):EndIf 
EndIf 
Wend 

Stop3D()

Return 





wydra:
;--------------------wydra
If tur()\wani=>48 And tur()\wani<64:Goto wydra2:EndIf 
If tur()\wani=>128 :Goto wydra2:EndIf 
If weapon=906 And tur()\wani=25:Gosub pulqq6:tur5()\hto=tur()\swo:EndIf 
If weapon=908 And tur()\wani=25:Gosub pulqq66:Gosub pulqq66:Gosub pulqq66:Gosub pulqq66:tur5()\hto=tur()\swo:EndIf 
If weapon=905 And tur()\wani=71:Gosub pulqq5:tur5()\hto=tur()\swo:EndIf 
If weapon=907 And tur()\wani=71:Gosub pulqq5:Gosub pulqq5:Gosub pulqq5:Gosub pulqq5:tur5()\hto=tur()\swo:EndIf 
If weapon=904 And tur()\wani=25:Gosub pulqq4:tur5()\hto=tur()\swo:EndIf 
If weapon=903 And tur()\wani=>22:Gosub pulqq3:tur5()\hto=tur()\swo:EndIf 
 If weapon=902 And tur()\wani=25:Gosub razrw:tur5()\hto=tur()\swo:EndIf 
 If weapon=901 And tur()\wani>20:Gosub ognem:tur5()\hto=tur()\swo:EndIf 
If weapon=900 And tur()\wani=25:Gosub pulqq:tur5()\hto=tur()\swo:EndIf 
If weapon=909 And tur()\wani=25:Gosub pulqq09:tur5()\hto=tur()\swo:EndIf 
If weapon=914 And tur()\wani=25:Gosub pulqq099:tur5()\hto=tur()\swo:EndIf 


wydra2:

If weapon=910 And stena=1 And play=tur()\swo:
stena=2:EndIf 
If tur()\stor=0 And tur()\wani=>48 And tur()\wani<64:DisplayTransparentSprite(502+tur()\wani , tur()\x + c, tur()\y + d):EndIf 
If tur()\stor=1 And tur()\wani=>48 And tur()\wani<64:DisplayTransparentSprite(502+tur()\wani+8 , tur()\x + c+5, tur()\y + d):EndIf

If tur()\stor=0 And tur()\wani=>48 And tur()\wani<52:DisplayTransparentSprite(502+tur()\wani , tur()\x + c, tur()\y + d):EndIf 
If tur()\stor=1 And tur()\wani=>48 And tur()\wani<52:DisplayTransparentSprite(502+tur()\wani+8 , tur()\x + c+5, tur()\y + d):EndIf

If tur()\stor=0 And tur()\wani=>16 And tur()\wani<48:DisplayTransparentSprite(500+tur()\wani , tur()\x + c, tur()\y + d-18):EndIf 
If tur()\stor=1 And tur()\wani=>16 And tur()\wani<48:DisplayTransparentSprite(500+tur()\wani+16 , tur()\x + c+5, tur()\y + d-18):EndIf

If tur()\stor=0 And tur()\wani=>64 And tur()\wani<128:DisplayTransparentSprite(500+tur()\wani , tur()\x + c, tur()\y + d-18):EndIf 
If tur()\stor=1 And tur()\wani=>64 And tur()\wani<128:DisplayTransparentSprite(500+tur()\wani+12 , tur()\x + c+5, tur()\y + d-18):EndIf

If tur()\stor=0 And tur()\wani=>128:DisplayTransparentSprite(500+tur()\wani , tur()\x + c, tur()\y + d):EndIf 
If tur()\stor=1 And tur()\wani=>128:DisplayTransparentSprite(500+tur()\wani+4 , tur()\x + c+5, tur()\y + d):EndIf

Start3D()

;If tur()\upal=0 And tur()\stor=0: RotateSprite3D(tur()\nom+tur()\wani, 370, 0):EndIf 
;If tur()\upal=1 And tur()\stor=0: RotateSprite3D(tur()\nom+tur()\wani, 360, 0):EndIf 
;If tur()\upal=1 And tur()\stor=1: RotateSprite3D(tur()\nom+tur()\wani+8, 370, 0):EndIf 
;If tur()\upal=0 And tur()\stor=1: RotateSprite3D(tur()\nom+tur()\wani+8, 370, 0):EndIf 
;If tur()\gravitator>20 And space=1 And tur()\stor=0: RotateSprite3D(tur()\nom+tur()\wani, 350, 0):EndIf 
; If tur()\gravitator>20 And space=1 And tur()\stor=1: RotateSprite3D(tur()\nom+tur()\wani+8, 350, 0):EndIf 

;If weapon=910:ZoomSprite3D(1011, fyr, fyr):EndIf 

If weapon=910 And play=tur()\swo:
   ExamineMouse() 
   xmz = MouseX()                         
   ymz = MouseY() 
   xmz-c:ymz-d
   xmz/48:xmz*48
   ymz/48:ymz*48
kras=0
    *Old_Element33 = @tur()
  
   ResetList( tur() ) 
   While NextElement( tur())
 If  tur()\nom=>9 And tur()\nom<=77 And SpriteCollision(21, xmz, ymz, tur()\nom, tur()\x, tur()\y):
:kras=1:
 :EndIf 
  Wend
  ChangeCurrentElement(tur(), *Old_Element33)
  If xmz+96<tur()\x Or  xmz-128>tur()\x:kras=1:EndIf 
  If ymz+96<tur()\y Or  ymz-128>tur()\y:kras=1:EndIf 
   If kras=1:DisplaySprite3D(1012 , xmz+c, ymz+d,200):EndIf 
  If kras=0:DisplaySprite3D(1011 , xmz+c, ymz+d,150):EndIf 
EndIf 

If stena=2 And kras=1:stena=0:EndIf 

If stena=2 And kras=0 And play=tur()\swo:
 *Old_Element22 = @tur()
   ExamineMouse() 
   xmz = MouseX()                         
   ymz = MouseY() 
   xmz-c:ymz-d
   xmz/48:xmz*48
   ymz/48:ymz*48
   wanim=10

 LastElement(tur())
 
  AddElement( tur() ) 
  tur()\x = xmz
  tur()\y = ymz
  tur()\nom = 21
  AddElement( tur() ) 
  tur()\x = xmz
  tur()\y = ymz
  tur()\nom = 96
  Gosub minusp:
  sl:
ChangeCurrentElement(tur(), *Old_Element22)

stena=0:fyr=8:EndIf 


If tur()\stor=0 And tur()\wani<16 : DisplaySprite3D(tur()\nom+tur()\wani , tur()\x + c, tur()\y + d,255):EndIf 
If tur()\stor=1 And tur()\wani<16 : DisplaySprite3D(tur()\nom+tur()\wani+8 , tur()\x + c+5, tur()\y + d,255):EndIf 


a=SpriteWidth(tur()\nom+tur()\wani)
b= SpriteHeight(tur()\nom+tur()\wani)
a/2
b/2
If tur()\wani=>16 And tur()\wani<48:b+24:EndIf 
If tur()\swo=play:
xti=-tur()\x+xraz/2-48
yti=-tur()\y+yraz/2-48

EndIf 
StartDrawing( ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent )
ff=StringByteLength(tur()\name$)
uhg=0:uhg2=0
If tur()\swo=0:uhg=16:uhg2=10:EndIf 
DrawText(tur()\x + c+a-(ff*2)+1-uhg2,tur()\y + d-b+38+stry+ uhg, tur()\name$, RGB(0,0,0))
DrawText(tur()\x + c+a-(ff*2)-1-uhg2,tur()\y + d-b+38+stry +uhg, tur()\name$, RGB(0,0,0))
DrawText(tur()\x + c+a-(ff*2)-uhg2,tur()\y + d-b+38+stry+uhg , tur()\name$, tur()\color )
    ff= tur()\energ+2
    If tur()\swo>0:
   Box(tur()\x + c+a-(ff/2)+1, tur()\y + d-b+55+stry, tur()\energ+2,5, RGB(0, 0, 0))
   Box(tur()\x + c+a-(ff/2)+2, tur()\y + d-b+55+stry+1, tur()\energ,3, RGB(255, 0, 0))
If tur()\swo=play
ff=tqqq
     Box(tur()\x + c+a-(ff/2),tur()\y + d-b+55+stry+4, tqqq+2,5, RGB(0, 0, 0))
     Box(tur()\x + c+a-(ff/2)+1,tur()\y + d-b+55+stry+5, tqqq,3, RGB(0, 200, 60))
 EndIf 
 EndIf 
     StopDrawing() 
     If tur()\smilet>12:DisplaySprite3D(tur()\smile , tur()\x+c+20, tur()\y+d-40,tur()\smilet):EndIf 
 If tur()\smilet2>0:tur()\smilet2-1:EndIf  
  If tur()\smilet2=0:tur()\smilet-12:EndIf 
Stop3D()
Return 



inercija:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=97 And tur()\iner>0:
tur()\iner2=0
If tur()\iner>0:tur()\iner-1:EndIf 
iner=1
Gosub stop
iner=0
:EndIf 

If tur()\nom=97 And tur()\iner2>0 :
If tur()\iner2>0:tur()\iner2-1:EndIf 
tur()\iner=0
iner=1
Gosub stop2
iner=0
:EndIf 
Wend
Return 

gravitacija:;------gravi

wanim=0

ResetList( tur() ) 
While NextElement( tur())



If tur()\nom=97 And tur()\iner>0:
tur()\iner2=0
If tur()\iner>0:tur()\iner-1:EndIf 
iner=1
Gosub stop
iner=0
:EndIf 
If tur()\nom=97 And tur()\iner2>0 :
If tur()\iner2>0:tur()\iner2-1:EndIf 
tur()\iner=0
iner=1
Gosub stop2
iner=0
:EndIf 

If tur()\wani=>128:tur()\wani+1:EndIf 
If tur()\wani=>132:tur()\wani-1:EndIf

If tur()\wani=>48 And tur()\wani<128:tur()\wani+1:EndIf 
If tur()\wani=>51 And tur()\wani<64:tur()\wani=0:EndIf 
If tur()\nom=97 And tur()\wani=>16 And tur()\wani<31:tur()\wani+1:Goto pokoj:EndIf 
If tur()\nom=97 And tur()\wani=31:tur()\wani=0:Goto pokoj:EndIf 
If tur()\nom=97 And tur()\wani=76:tur()\wani=0:Goto pokoj:EndIf 
If tur()\nom=97  And tur()\wani=>16 And tur()\wani<128::Goto pokoj:EndIf 
If tur()\nom=97  And tur()\upal=1:Gosub upal2:EndIf 
If tur()\nom=97  And tur()\x=tur()\x2:tur()\wani=0:Goto pokoj:EndIf 
If tur()\gravitator>0  And tur()\nom=97 And tur()\x<tur()\x2 And tur()\iner=0:Gosub stop:Gosub wani2:EndIf 
If tur()\gravitator>0  And tur()\nom=97 And tur()\x>tur()\x2 And tur()\iner2=0:Gosub stop2:Gosub wani2:EndIf



If tur()\nom=97  And tur()\x<tur()\x2 And tur()\iner=0::Gosub stop:Gosub wani2:EndIf 
If tur()\nom=97  And tur()\x>tur()\x2 And tur()\iner2=0::Gosub stop2:Gosub wani2:EndIf 
pokoj:

 




 If  tur()\nom=97:*Old_Element = @tur():stor=tur()\stor:gravitator=tur()\gravitator:wani=tur()\wani:swo=tur()\swo:wyd=tur()\nom:
 xww=tur()\x:yww=tur()\y:upal=tur()\upal :Gosub gravitacija2:Gosub pok:
 tur()\y=yww:tur()\upal=upal:tur()\gravitator=gravitator:EndIf 

Wend


Return

pok:

ChangeCurrentElement(tur(), *Old_Element):

PreviousElement(tur())

aas=SpriteWidth(tur()\nom)
If tur()\nom=500 And tur()\swo=swo:tur()\wani=wani:tur()\stor=stor:tur()\x=xww-(aas/2)+24:tur()\y=yww-44:tur()\upal=upal:tur()\gravitator=gravitator:EndIf
NextElement(tur())

If tur()\nom=97 And tur()\x<>tur()\x2 And tur()\swo=play:push=0:EndIf 

If tur()\upal=1 :spid=tur()\gravitator/4:EndIf 

If tur()\upal=0:spid=asas:EndIf 

spid2=tur()\spid 

Return 

pokk:
ResetList( tur() ) 
While NextElement( tur())
aas=SpriteWidth(tur()\nom)
If tur()\nom=500 And tur()\swo=swo:tur()\wani=wani:tur()\stor=stor:tur()\x=xww-(aas/2)+24:tur()\y=yww-44:tur()\upal=upal:tur()\gravitator=gravitator:EndIf

If tur()\nom=97 And tur()\x<>tur()\x2 And tur()\swo=play:push=0:EndIf 
;If gravitator>0:push=0:EndIf 


If tur()\nom=97 And tur()\swo=play:

If tur()\upal=1 :spid=tur()\gravitator/4:EndIf 

If tur()\upal=0:spid=asas:EndIf 

spid2=tur()\spid 

:EndIf 
Wend
ChangeCurrentElement(tur(), *Old_Element):
Return 

stop:

aaa=0
wyd=tur()\nom:xww=tur()\x:yww=tur()\y:a2=tur()\iner:spi=tur()\spid
*Old_Element = @tur() 
ResetList( tur() )
While NextElement( tur())
If iner=1:Goto sli:EndIf 

If tur()\nom=>970 Or tur()\nom=67 Or tur()\nom=10 Or tur()\nom=11 Or tur()\nom=12 Or tur()\nom=13  Or tur()\nom=16 Or tur()\nom=17  Or tur()\nom=18 Or tur()\nom=19 Or tur()\nom=21 Or tur()\nom=22 Or tur()\nom=23 Or tur()\nom=24:
Gosub stop3
EndIf 
sli2:
Wend 

ChangeCurrentElement(tur(), *Old_Element)

If tur()\iner>0 And iner=1 And aaa=1:
tur()\x2=tur()\x

tur()\iner2=tur()\iner/2
tur()\iner=0
Return 
EndIf

If iner=1 And aaa=0 And tur()\iner>0
tur()\x+tur()\iner/2
tur()\x2+tur()\iner/2
Return 
EndIf 


If aaa=1:tur()\x2=tur()\x:EndIf 
a=tur()\spid
Repeat
If aaa=0:tur()\x+1:tur()\stor=0:EndIf 
If tur()\x=tur()\x2:Return:Goto pokoj:EndIf 
a-1
Until a=0
Return 

sli:
If tur()\nom=10 Or tur()\nom=11 Or tur()\nom=12 Or tur()\nom=13  Or tur()\nom=16 Or tur()\nom=17  Or tur()\nom=18 Or tur()\nom=19 Or tur()\nom=21 Or tur()\nom=22 Or tur()\nom=23 Or tur()\nom=24:
Gosub stop3a
EndIf 
Goto sli2

sli3:
If tur()\nom=10 Or tur()\nom=11 Or tur()\nom=12 Or tur()\nom=13  Or tur()\nom=16 Or tur()\nom=17  Or tur()\nom=18 Or tur()\nom=19 Or tur()\nom=21 Or tur()\nom=22 Or tur()\nom=23 Or tur()\nom=24:
Gosub stop4a
EndIf 
Goto sli4

stop2:
aaa=0
wyd=tur()\nom:xww=tur()\x:yww=tur()\y:a2=tur()\iner2:spi=tur()\spid
*Old_Element = @tur() 
ResetList( tur() )
While NextElement( tur())
If iner=1:Goto sli3:EndIf 
If tur()\nom=>970 Or tur()\nom=10 Or tur()\nom=67 Or tur()\nom=11 Or tur()\nom=12 Or tur()\nom=13  Or tur()\nom=16 Or tur()\nom=17  Or tur()\nom=18 Or tur()\nom=19 Or tur()\nom=21 Or tur()\nom=22 Or tur()\nom=23 Or tur()\nom=24:

Gosub stop4
EndIf 
sli4:
Wend 
ChangeCurrentElement(tur(), *Old_Element)

If tur()\iner2>0 And iner=1 And aaa=1
tur()\x+2
tur()\x2=tur()\x
tur()\iner=tur()\iner2/2
tur()\iner2=0
Return 
EndIf 

If iner=1 And aaa=0 And tur()\iner2>0
tur()\x-tur()\iner2/2
tur()\x2-tur()\iner2/2
Return 
EndIf 
If aaa=1:tur()\x2=tur()\x:EndIf 



a=tur()\spid
Repeat
If aaa=0:tur()\x-1:tur()\stor=1:EndIf 
If tur()\x=tur()\x2:Return:Goto pokoj:EndIf 
a-1
Until a=0


Return 


stop3a:
If SpriteCollision(97, xww, yww, tur()\nom, tur()\x-a2, tur()\y+1)=1:aaa=1:Return:EndIf 
Return 

stop4a:
If SpriteCollision(97, xww, yww, tur()\nom, tur()\x+a2, tur()\y+1)=1:tur()\x2=tur()\x:aaa=1:Return:EndIf 
Return 

stop3:
kto=tur()\nom
rrrr=0
If tur()\nom=67 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x-spi, tur()\y+1)=1:
Gosub wzylpriz
kris=1013-15:Gosub wzryw2:kris=0:
DeleteElement( tur() )
Return:
:EndIf 

If tur()\nom=>970 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x-spi, tur()\y+1)=1:
Gosub wzylpriz
If rrrr=1:Return:EndIf 
kris=1013-15:Gosub wzryw2:kris=0:
DeleteElement( tur() )
Return:
:EndIf 

If SpriteCollision(97, xww, yww, tur()\nom, tur()\x-spi, tur()\y+1)=1:
aaa=1:wanim=0::Return:EndIf 
Return 

stop4:
rrrr=0
kto=tur()\nom
If tur()\nom=67 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x+spi, tur()\y+1)=1:
Gosub wzylpriz
kris=1013-15:Gosub wzryw2:kris=0:
DeleteElement( tur() )
Return:
:EndIf 

If tur()\nom=>970 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x+spi, tur()\y+1)=1::
Gosub wzylpriz
If rrrr=1:Return:EndIf 
kris=1013-15:Gosub wzryw2:kris=0:
DeleteElement( tur() )
Return:
:EndIf 


If SpriteCollision(97, xww, yww, tur()\nom, tur()\x+spi, tur()\y+1)=1:tur()\x2=tur()\x:aaa=1:Return:EndIf 
Return 

 
 
 
 
gravitacija2:



;Gosub tut2 
;Gosub tut

ao=gravitator/2
ao+1
aaa=ao


If upal=0:
Repeat
 Gosub tut3
If upal=1:ao=0:Return:EndIf 
yww+1
ao-1
Until ao=0
If swo=play:asas=aaa:EndIf  
gravitator+1

EndIf

Return 

tut:
If SpriteCollision(97, xwww, yww, 96, xwwww, ywwww)=1:Goto tut3:EndIf
Return 
tut3:
ResetList( tur() )
While NextElement( tur())
If swo=play And tur()\nom=250 And SpriteCollision(250, xww, yww, tur()\nom, tur()\x, tur()\y+50)=1:upal=1:tur()\nom=251:tur()\swo=3:gravitator=120:Return:EndIf 
If tur()\nom=77 And SpriteCollision(77, xww, yww, tur()\nom, tur()\x, tur()\y+85)=1:upal=1:gravitator=0:Return:EndIf 
If tur()\nom=96 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x, tur()\y)=1:upal=1:Return:EndIf 
If tur()\nom=30 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x, tur()\y)=1:Goto teleport:EndIf 
Wend 
Return

tut2:
ywww=yww+48
ywww/48
ywww*48
xwww=xww
xwww/48
xwww*48
ResetList( tur() )
While NextElement( tur())
If tur()\nom=96 And tur()\y=ywww And tur()\x=xwww:ywwww=tur()\y-1:xwwww=tur()\x:Return:EndIf
Wend 
Return 


;----------------------upal2
upal2: 
tur()\gravitator-6
gravitator=tur()\gravitator
If tur()\gravitator>0:tur()\y-(gravitator/4):Return:EndIf

upal=0 
tur()\upal=0
space=0
tur()\gravitator=0
gravitator=0
Return 



wani2:
If anim2=0:Goto wani3:EndIf
If anim2=2:Goto wani3:EndIf
Return 
wani3:
If tur()\wani=>16 Or aaa=1:Return:EndIf 
wanim=1
tur()\wani+1
If tur()\wani=8:tur()\wani=0:EndIf 
Return 




soz:
  AddElement( tur2() )
  tur2()\xx = xx
  tur2()\yy = yy
  tur2()\x = xx+Random(48)
  tur2()\y = yy
  tur2()\nom = 1
  tur2()\ani = 16+Random(128)
  tur2()\tim = 0+Random(8)
    tur2()\tim2= tur2()\tim
    tur2()\pow = Random(3)
Return 


instalp:
ResetList( tur3() ) 
While NextElement( tur3())
a1=tur3()\energ
a11=tur3()\energ1
a111=tur3()\energ2
a2=tur3()\color
a3=tur3()\pnom
a$=tur3()\name$
Gosub inst2:
Wend 
Return 

inst2:
ResetList( tur() ) 
abb=Random(ListSize(tur()) )
If abb=0:abb+1:EndIf 
If abb=>ListSize(tur()):abb-1:EndIf 
SelectElement(tur(), abb)
If tur()\nom=09:
x=tur()\x
y=tur()\y
Goto inst:
EndIf 

Goto inst2
Return 

inst:
ResetList( tur() ) 
While NextElement( tur())
 Wend
 
  AddElement( tur() )
  tur()\x = x
  tur()\x2 = x
  tur()\y = y
  tur()\nom = 500
    tur()\swo = a3
     tur()\upal = 0
        tur()\gravitator = 0
        tur()\name$=a$
        tur()\energ=a1
        tur()\energ1=a11
        tur()\energ2=a111
        tur()\color=a2
       
  AddElement( tur() )
  tur()\x = x
  tur()\x2 =x
  tur()\y = y
  tur()\nom = 97
   tur()\spid =3
    tur()\swo = a3
       tur()\upal = 0
       tur()\gravitator = 0
Return 





save:
CreateFile(0,"Tur/tur1.txt")
ResetList( tur() ) 
While NextElement( tur())
WriteLong(0,tur()\nom)
WriteLong(0,tur()\x)
WriteLong(0,tur()\y)
WriteLong(0,tur()\swo)
Wend
CloseFile(0) 
Return
CreateFile(0,"Tur/tur1dubl.txt")
ResetList( tur() ) 
While NextElement( tur())
WriteLong(0,tur()\nom)
WriteLong(0,tur()\x)
WriteLong(0,tur()\y)
WriteLong(0,tur()\swo)
Wend
CloseFile(0) 
Return


load:
ResetList( tur() ) 
While NextElement( tur())
DeleteElement( tur() )
Wend
OpenFile(0,"Tur/tur2.txt")
Length = Lof(0)
ResetList( tur() ) 
Repeat
AddElement( tur() )
tur()\nom=ReadLong(0)
tur()\x=ReadLong(0)
tur()\y=ReadLong(0)
tur()\swo=ReadLong(0)
Length-16
Until Length=0
CloseFile(0)
Return
;----------------------teleport
teleport:
If swo=play: 
If tur()\swo=0:Goto teleport20:EndIf 
If tur()\swo=1:Goto teleport2:EndIf 
If tur()\swo=2:Goto teleport23:EndIf 
If tur()\swo=3:Goto teleport202:EndIf
:EndIf 
Return
teleport2:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=30 And tur()\swo=0:Goto teleport3:EndIf 
Wend 
Return 
teleport20:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=30 And tur()\swo=1:Goto teleport3:EndIf 
Wend 
Return 
teleport23:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=30 And tur()\swo=3:Goto teleport3:EndIf 
Wend 
Return 
teleport202:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=30 And tur()\swo=2:Goto teleport3:EndIf 
Wend 
Return 


teleport3:
xww=tur()\x:yww=tur()\y
yww+47
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=97 And play=tur()\swo:tur()\x=xww:tur()\y=yww:tur()\x2=xww:tur()\y2=yww:tur()\gravitator=0
tur()\upal=0
gravitator=0
space=0
upal=0:Goto teleport50:EndIf 
Wend 

Return 
teleport50:
xwwww=xww
ywwww=yww
ywwww-10
xwwww+10
a000=1
teleport=4
teleport3=1
teleport2=1
Return 

teleportkre:;
If teleport2=1:Goto teleportkre2:EndIf 
Return 

teleportkre2:
teleport3-1
If teleport3=0:Goto teleportkre4:EndIf 
Return 

teleportkre4:
teleport3=a000
a000+1
If teleport=0:teleport2=0:EndIf 
teleport-1
a0=0
Repeat
AddElement( tur4() )
  tur4()\x = xwwww
  tur4()\y = ywwww
  tur4()\nom = a000
  tur4()\degr=a0
  If a0=0:tur4()\life = 25:EndIf 
  If a0=2:tur4()\life = 25:EndIf
  If a0=4:tur4()\life = 25:EndIf
  If a0=6:tur4()\life = 25:EndIf
  If a0=1:tur4()\life = 18:EndIf 
  If a0=3:tur4()\life = 18:EndIf
  If a0=5:tur4()\life = 18:EndIf
  If a0=7:tur4()\life = 18:EndIf
  a0+1
  Until a0=8
  Return 
  ikonn:
  If iko=0:Return:EndIf 
  DisplayTransparentSprite (1010 , xraz/2-(196/2), yraz/2-(96/2)-50)
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And play=tur()\swo:Gosub ikonnn:EndIf 
Wend

Return 
ikonnn:
  StartDrawing( ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent )
ff=StringByteLength(tur()\name$)
DrawText(70+xraz/2-(196/2)-ff*3, 30+yraz/2-(96/2)-50, "Ходит ", RGB((255),(200),(100)) )
DrawText(70+xraz/2-(196/2)-ff*3+46, 30+yraz/2-(96/2)-50, tur()\name$, tur()\color )
  StopDrawing() 
  Return 
  
ikon:      
Gosub ikonn
DisplayTransparentSprite (1009 , 0, yraz-130)
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=play:xg=tur()\x:yg=tur()\y:aq=tur()\swo:Goto ikon2:EndIf 
Wend
Return 
ikon2:
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=aq:bq=tur3()\money:cq=tur3()\opyt:tqqq=tur3()\trafic:Goto ikon3:EndIf 
Wend
Return 

ikon3: 
If wanim=>1 And tur3()\trafic3>0:Gosub mint:EndIf 
StartDrawing( ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent )
cqq=StringByteLength(Str(cq))
DrawText(307-cqq*3, yraz-104, Str(cq), RGB((255),(200),(100)) )
cqq=StringByteLength(Str(bq))
DrawText(307-cqq*3, yraz-70, Str(bq), RGB((255),(200),(100)) )


  StopDrawing() 
  If igroplay<2:
level=tur3()\kakoj
If level=0:ax=tur3()\slot1p:weapon=tur3()\slot1:EndIf 
If level=32:ax=tur3()\slot2p:weapon=tur3()\slot2:EndIf
If level=64:ax=tur3()\slot3p:weapon=tur3()\slot3:EndIf
If level=96:ax=tur3()\slot4p:weapon=tur3()\slot4:EndIf
If level=128:ax=tur3()\slot5p:weapon=tur3()\slot5:EndIf
If level=160:ax=tur3()\slot6p:weapon=tur3()\slot6:EndIf
If level=192:ax=tur3()\slot7p:weapon=tur3()\slot7:EndIf
If level=224:ax=tur3()\slot8p:weapon=tur3()\slot8:EndIf

;-------------ikony

igroplay+1
  :EndIf 
  DisplayTransparentSprite (7, 19+level, yraz-103-6)
DisplayTransparentSprite(1500, 2+xraz/2-128-32-32, 2)
DisplayTransparentSprite(1501, 2+64+xraz/2-128-32-32, 2)
DisplayTransparentSprite(1502, 2+128+xraz/2-128-32-32, 2)
DisplayTransparentSprite(1503, 2+128+64+xraz/2-128-32-32, 2)
DisplayTransparentSprite(1504, 2+128+128+xraz/2-128-32-32, 2)
DisplayTransparentSprite(1505, 2+128+128+64+xraz/2-128-32-32, 2)

or1=0:or2=0:or3=0:or4=0
or5=0:or6=0:or7=0:or8=0
or1a=0:or2a=0:or3a=0:or4a=0

If tur3()\slot1>0:DisplayTransparentSprite(tur3()\slot1,20,yraz-124+22-6):or1=tur3()\slot1:EndIf 
If tur3()\slot2>0:DisplayTransparentSprite(tur3()\slot2,52,yraz-124+22-6):or2=tur3()\slot2:EndIf 
If tur3()\slot3>0:DisplayTransparentSprite(tur3()\slot3,84,yraz-124+22-6):or3=tur3()\slot3:EndIf 
If tur3()\slot4>0:DisplayTransparentSprite(tur3()\slot4,116,yraz-124+22-6):or4=tur3()\slot4:EndIf 
If tur3()\slot5>0:DisplayTransparentSprite(tur3()\slot5,148,yraz-124+22-6):or5=tur3()\slot5:EndIf 
If tur3()\slot6>0:DisplayTransparentSprite(tur3()\slot6,170+10,yraz-124+22-6):or6=tur3()\slot6:EndIf 
If tur3()\slot7>0:DisplayTransparentSprite(tur3()\slot7,200+12,yraz-124+22-6):or7=tur3()\slot7:EndIf 
If tur3()\slot8>0:DisplayTransparentSprite(tur3()\slot8,230+14,yraz-124+22-6):or8=tur3()\slot8:EndIf 

If tur3()\slot1a>0:DisplayTransparentSprite(tur3()\slot1a,13,yraz-124+22-6+60):or1a=tur3()\slot1a:EndIf 
If tur3()\slot2a>0:DisplayTransparentSprite(tur3()\slot2a,13+32,yraz-124+22-6+60):or2a=tur3()\slot2a:EndIf 
If tur3()\slot3a>0:DisplayTransparentSprite(tur3()\slot3a,13+64,yraz-124+22-6+60):or3a=tur3()\slot3a:EndIf 
If tur3()\slot4a>0:DisplayTransparentSprite(tur3()\slot4a,13+96,yraz-124+22-6+60):or4a=tur3()\slot4a:EndIf 
DisplayTransparentSprite(911,230+70,yraz-47)
;If ym3>yraz-124+22-6 And ym3<yraz-124+22-6+35 And xm3>20 And xm3<230+14+32:Return:EndIf 



StartDrawing( ScreenOutput())
DrawingFont(FontID(2)) 
DrawingMode(#PB_2DDrawing_Transparent )
b=TextWidth("00000")
bb=TextWidth(Str(ax))
bbb=b-bb
DrawText(21+1+level+bbb, yraz-76+1 , Str(ax), RGB((0),(0),(0)) )
DrawText(21+level+bbb, yraz-76 , Str(ax), RGB((255),(255),(255)) )


axx=tur3()\energ2

DrawText(2+18+xraz/2-128+1-64, 3+1, Str(axx), RGB((0),(0),(0)) )
DrawText(2+18+xraz/2-128-64, 3, Str(axx), RGB((255),(255),(255)) )

axx=tur3()\reani

DrawText(2+18+xraz/2-128+64-64+1, 3+1, Str(axx), RGB((0),(0),(0)) )
DrawText(2+18+xraz/2-128+64-64, 3, Str(axx), RGB((255),(255),(255)) )

axx=tur3()\ataka

DrawText(2+18+xraz/2-128+128+1-64, 3+1, Str(axx), RGB((0),(0),(0)) )
DrawText(2+18+xraz/2-128+128-64, 3, Str(axx), RGB((255),(255),(255)) )

axx=tur3()\gravi

DrawText(2+18+xraz/2-128+64+128+1-64, 3+1, Str(axx), RGB((0),(0),(0)) )
DrawText(2+18+xraz/2-128+64+128-64, 3, Str(axx), RGB((255),(255),(255)) )

axx=tur3()\trafic5

DrawText(2+18+xraz/2-128+128+128+1-64, 3+1, Str(axx), RGB((0),(0),(0)) )
DrawText(2+18+xraz/2-128+128+128-64, 3, Str(axx), RGB((255),(255),(255)) )


axx=tur3()\metko

DrawText(2+18+xraz/2-128+128+128+1, 3+1, Str(axx), RGB((0),(0),(0)) )
DrawText(2+18+xraz/2-128+128+128, 3, Str(axx), RGB((255),(255),(255)) )
StopDrawing( )
Return 









skana:
ResetList( tur() ) 
While NextElement( tur())
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=tur()\swo And tur()\energ>0:
If tur3()\slot1a=972 Or tur3()\slot2a=972 Or tur3()\slot3a=972 Or tur3()\slot4a=972:
tur()\energ+1
:EndIf 
If tur3()\slot1a=973 Or tur3()\slot2a=973 Or tur3()\slot3a=973 Or tur3()\slot4a=973:
tur()\energ+2
:EndIf 
If tur3()\slot1a=976 Or tur3()\slot2a=976 Or tur3()\slot3a=976 Or tur3()\slot4a=976:
tur()\energ+3
:EndIf 
If tur()\energ>64:tur()\energ=64:EndIf 
If tur3()\slot1a=980 Or tur3()\slot2a=980 Or tur3()\slot3a=980 Or tur3()\slot4a=980:
a=0
If a=0 And Random(30)=0 And tur3()\slot2>0:tur3()\slot2p+1:a=1:EndIf 
If a=0 And Random(30)=0 And tur3()\slot3>0:tur3()\slot3p+1:a=1:EndIf 
If a=0 And Random(30)=0 And tur3()\slot4>0:tur3()\slot4p+1:a=1:EndIf 
If a=0 And Random(30)=0 And tur3()\slot5>0:tur3()\slot5p+1:a=1:EndIf 
If a=0 And Random(30)=0 And tur3()\slot6>0:tur3()\slot6p+1:a=1:EndIf 
If a=0 And Random(30)=0 And tur3()\slot7>0:tur3()\slot7p+1:a=1:EndIf 
If a=0 And Random(30)=0 And tur3()\slot8>0:tur3()\slot8p+1:a=1:EndIf 
:EndIf 
:EndIf 
Wend
Wend
Return 






mint:

;-----------------------------WARNING
Repeat 
tur3()\trafic3-1
 If tur3()\trafic3=0:Gosub mint2:EndIf 
wanim-1
Until wanim=0
Return 
mint2:
If tur3()\trafic3=0 And wanim=>1 And tur3()\trafic>0:tur3()\trafic-1:EndIf
If tur3()\trafic3=0:tur3()\trafic3=tur3()\trafic4+Random(tur3()\trafic5):EndIf 
If tur3()\trafic=0:Goto nextplay:EndIf ;-----------------передал ход
Return 







nextplay:

or1a=0:or2a=0:or3a=0:or4a=0
tur3()\trafic=tur3()\trafic2
Gosub skana
igroplay=0
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=97 Or tur()\nom=500:tur()\x2=tur()\x:tur()\y2=tur()\y:
If tur()\wani<128
tur()\wani=0
EndIf 
:EndIf 
Wend
suda:
play+1

ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo2=play And tur()\swo=0:
play+1

Goto opanihuja2
EndIf 
Wend

opanihuja2:

If players>0:players-1:EndIf 
push=0
If players=0:players=players2:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And tur()\swo=1:play=1:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=2:play=2:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=3:play=3:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=4:play=4:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=5:play=5:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=6:play=6:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=7:play=7:Goto opanihuja:EndIf 
If tur()\nom=500 And tur()\swo=8:play=8:Goto opanihuja:EndIf 
Wend
:EndIf 

opanihuja:
If play>play2:play=0:Goto suda:EndIf 
Debug play
Debug players
Debug players2
spid3=1
xti=0
yti=0
iko=10
Return 
;---------------babah
babah:


ResetList( tur6() ) 
While NextElement( tur6())
If tur6()\nom=15:Gosub babah2:EndIf 
Wend
Return
babah2:
If tur6()\kris<>913:ZoomSprite3D(tur6()\spr+tur6()\kris, tur6()\degr+32, tur6()\degr+32):EndIf 
If tur6()\kris=913:ZoomSprite3D(913, tur6()\degr-32, tur6()\degr-32):EndIf 
Start3D()
Sprite3DBlendingMode(10, 7)
If tur6()\kris<>913:DisplaySprite3D(tur6()\spr+tur6()\kris ,  tur6()\x+c, tur6()\y+d,255):EndIf 
If tur6()\kris=913:DisplaySprite3D(913 ,  tur6()\x+c+32, tur6()\y+d,10):EndIf 
Sprite3DBlendingMode(0, 0)
Stop3D()
If Random(0)=0 And tur6()\spr<21 And tur6()\kris=0::tur6()\spr+1:EndIf 
If Random(0)=0 And tur6()\spr<29 And tur6()\kris>0::tur6()\spr+1:EndIf 
tur6()\x+tur6()\xx
tur6()\y+tur6()\yy
xwzq=tur6()\x
ywzq=tur6()\y

If Random(20)=0:
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=500 And SpriteCollision(tur()\nom,tur()\x,tur()\y,tur6()\spr,tur6()\x,tur6()\y):
If tur6()\cwet2>10 And  tur6()\cwet2<>25:
a=1:
If tur6()\kris=0:
;Gosub otnqtx
:EndIf 
EndIf 

If tur6()\cwet2=25 And play<>tur()\swo:
a=1:
If tur6()\kris=0:

NextElement(tur())
If tur()\stor=0:tur()\iner=4:EndIf 
If tur()\stor=1:tur()\iner2=4:EndIf 
PreviousElement(tur())
a=1
;Gosub otnqtx22
:EndIf 

EndIf 

:EndIf 
Wend
EndIf 

tur6()\life-1
a=255
radi=tur6()\cwet2
a/radi
tur6()\cwet-a
If tur6()\life=0:DeleteElement(tur6()):Return:EndIf 
If tur6()\cwet<=0:DeleteElement(tur6()):EndIf 


Return 



instalb:
;If insi=1:Return:EndIf 
;insi=1
b=rwzr*radi
Repeat


sss666=Random(radi)
If Random(200)=0:sss666+Random(20):EndIf 
radius=radi-sss666
X666.f = 2+sss666
Y666.f = 2+X666.f
s666.f=Random(10)
s666.f/10
ss666.f=Random(10)
ss666.f/100
aaaa.f=Random(5)+s666.f+ss666.f
x23666.f = X666*Cos(aaaa) + Y666*Sin(aaaa)
y23666.f = X666*Sin(aaaa) - Y666*Cos(aaaa)
 AddElement( tur6() )
 a000=Random(wzr)+1
    tur6()\x=xwz-a000/2
    tur6()\y=ywz-a000/2
    tur6()\xx=x23666
    tur6()\yy=y23666
    tur6()\nom=15
    tur6()\kris=kris
    tur6()\degr=a000
    tur6()\life=1+Random(radius)
    tur6()\cwet=255
    tur6()\cwet2=radi
    tur6()\spr=15
    b-1
      Until b=0
Return 


instalbb:
;If insi=1:Return:EndIf 
;insi=1
b=rwzr*radi
Repeat
sss666=Random(radi) 
radius=radi-sss666
X666.f = 2+sss666
Y666.f = 2+X666.f
s666.f=Random(10)
s666.f/10
ss666.f=Random(10)
ss666.f/100
x23666.f = X666*Cos(aaaa) + Y666*Sin(aaaa)
y23666.f = X666*Sin(aaaa) - Y666*Cos(aaaa)
 AddElement( tur6() )
 a000=Random(wzr)+1
    tur6()\x=xwz-a000/2
    tur6()\y=ywz-a000/2
    tur6()\xx=x23666
    tur6()\yy=y23666
    tur6()\nom=15
    tur6()\degr=a000
    tur6()\life=1+Random(radius)
    tur6()\cwet=255
    tur6()\cwet2=radi
    tur6()\spr=15
    b-1
      Until b=0
Return 

;------------------priz
wzylpriz:


*Old_Element66 = @tur() 
ChangeCurrentElement(tur(), *Old_Element)

ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=tur()\swo And kto=67:
tur3()\money+10
If or1a=971 Or  or2a=971 Or  or3a=971 Or  or4a=971:tur3()\money+4:EndIf 
If or1a=975 Or  or2a=975 Or  or3a=975 Or  or4a=975:tur3()\money+1:EndIf 

rrrr=0
If Random(100)=0:
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=991
NextElement(tur())
EndIf

AddElement(tur8())
tur8()\x=tur()\x+50
tur8()\y=tur()\y-20
tur8()\nom=10
tur8()\plus=1
tur8()\rand=0
If or1a=971 Or  or2a=971 Or  or3a=971 Or  or4a=971:tur8()\nom+4:EndIf
If or1a=975 Or  or2a=975 Or  or3a=975 Or  or4a=975:tur8()\nom+1:EndIf
:EndIf 


If tur3()\pnom=tur()\swo And kto=>970:

If tur3()\slot1a=0:tur3()\slot1a=kto:Goto rand:EndIf 
If tur3()\slot2a=0:tur3()\slot2a=kto:Goto rand:EndIf 
If tur3()\slot3a=0:tur3()\slot3a=kto:Goto rand:EndIf 
If tur3()\slot4a=0:tur3()\slot4a=kto:Goto rand:EndIf 
rrrr=1:Goto rand1:

:EndIf 
Wend 
Goto rand1:
rand:
PreviousElement(tur())
tur()\smilet=255
tur()\smilet2=50
tur()\smile=991
;If kto=970:tur()\energ2+1:EndIf 
NextElement(tur())

Gosub instor22
rand1:

ChangeCurrentElement(tur(), *Old_Element66)


Return 



textl:
ResetList( tur8() ) 
While NextElement( tur8())
If tur8()\nom>0: 
 StartDrawing( ScreenOutput())
 DrawingMode(#PB_2DDrawing_Transparent )
DrawingFont(FontID(0)) 
If tur8()\plus=1:DrawText(tur8()\x+c,tur8()\y+d , "+ "+Str(tur8()\nom), RGB((255),(255),(255)) ):EndIf 
If tur8()\plus=0:DrawText(tur8()\x+c,tur8()\y+d , "- "+Str(tur8()\nom), RGB((255),(20),(0)) ):EndIf 
  StopDrawing() 
  tur8()\y-1
  If tur8()\rand=1:tur8()\x-1:EndIf 
    If tur8()\rand=2:tur8()\x+1:EndIf 
      If tur8()\rand=3:tur8()\y-1:EndIf 
         If tur8()\rand=4:tur8()\y-2:EndIf 
         If tur8()\rand=5:tur8()\x+2:EndIf 
         If tur8()\rand=6:tur8()\x-2:EndIf 
         If tur8()\rand=7:tur8()\x+2:tur8()\y-1:EndIf 
         If tur8()\rand=8:tur8()\x+2:tur8()\y-1:EndIf 
  tur8()\life+1
  If tur8()\life=60:DeleteElement(tur8())
  EndIf 
   EndIf 
  Wend 
Return 


instor:
ResetList( tur3() ) 
While NextElement( tur3())
a=8
Repeat 
If tur3()\slot1=0:
tur3()\slot1p=tur3()\slot2p
tur3()\slot1=tur3()\slot2
tur3()\slot2=0:tur3()\slot2p=0
EndIf 
If tur3()\slot2=0:
tur3()\slot2p=tur3()\slot3p
tur3()\slot2=tur3()\slot3
tur3()\slot3=0:tur3()\slot3p=0
EndIf 
If tur3()\slot3=0:
tur3()\slot3p=tur3()\slot4p
tur3()\slot3=tur3()\slot4
tur3()\slot4=0:tur3()\slot4p=0
EndIf 
If tur3()\slot4=0:
tur3()\slot4p=tur3()\slot5p
tur3()\slot4=tur3()\slot5
tur3()\slot5=0:tur3()\slot5p=0
EndIf 
If tur3()\slot5=0:
tur3()\slot5p=tur3()\slot6p
tur3()\slot5=tur3()\slot6
tur3()\slot6=0:tur3()\slot6p=0
EndIf 
If tur3()\slot6=0:
tur3()\slot6p=tur3()\slot7p
tur3()\slot6=tur3()\slot7
tur3()\slot7=0:tur3()\slot7p=0
EndIf 
If tur3()\slot7=0:
tur3()\slot7p=tur3()\slot8p
tur3()\slot7=tur3()\slot8
tur3()\slot8=0:tur3()\slot8p=0
EndIf 
a-1
Until a=0

If tur3()\slot1a=0:
tur3()\slot1a=tur3()\slot2a
tur3()\slot2a=0
EndIf 
If tur3()\slot2a=0:
tur3()\slot2a=tur3()\slot3a
tur3()\slot3a=0
EndIf 
If tur3()\slot3a=0:
tur3()\slot3a=tur3()\slot4a
tur3()\slot4a=0
EndIf 

Wend 


Gosub instor2
Return 

instor2:
ResetList( tur3() ) 
While NextElement( tur3())

If tur3()\slot1a=970:
tur3()\energ2+1
tur3()\ataka+1
EndIf 
If tur3()\slot1a=972:
tur3()\reani+1
EndIf 
If tur3()\slot1a=973:
tur3()\reani+2
EndIf 
If tur3()\slot1a=974:
tur3()\gravi+3
EndIf 
If tur3()\slot1a=976:
tur3()\reani+3
EndIf 
If tur3()\slot1a=977:
tur3()\gravi+1
EndIf 
If tur3()\slot1a=978:
tur3()\gravi+5
EndIf 
If tur3()\slot1a=979:
tur3()\ataka+3
EndIf 
If tur3()\slot1a=981:
tur3()\trafic5+1
EndIf 
If tur3()\slot1a=984:
tur3()\metko+4
tur3()\ataka+2
tur3()\energ2+2
EndIf 
If tur3()\slot1a=985:
tur3()\ataka+2
tur3()\energ2+5
EndIf 
If tur3()\slot1a=986:
tur3()\gravi+1
tur3()\trafic5+3
EndIf 
If tur3()\slot1a=987:
tur3()\energ2+3
EndIf 



If tur3()\slot2a=970:
tur3()\energ2+1
tur3()\ataka+1
EndIf 
If tur3()\slot2a=972:
tur3()\reani+1
EndIf 
If tur3()\slot2a=973:
tur3()\reani+2
EndIf 
If tur3()\slot2a=974:
tur3()\gravi+3
EndIf 
If tur3()\slot2a=976:
tur3()\reani+3
EndIf 
If tur3()\slot2a=977:
tur3()\gravi+1
EndIf
If tur3()\slot2a=978:
tur3()\gravi+5
EndIf 
If tur3()\slot2a=979:
tur3()\ataka+3
EndIf 
If tur3()\slot2a=981:
tur3()\trafic5+1
EndIf 
If tur3()\slot2a=984:
tur3()\metko+4
tur3()\ataka+2
tur3()\energ2+2
EndIf 
If tur3()\slot2a=985:
tur3()\ataka+2
tur3()\energ2+5
EndIf 
If tur3()\slot2a=986:
tur3()\gravi+1
tur3()\trafic5+3
EndIf 
If tur3()\slot2a=987:
tur3()\energ2+3
EndIf 



If tur3()\slot3a=970:
tur3()\energ2+1
tur3()\ataka+1
EndIf 
If tur3()\slot3a=972:
tur3()\reani+1
EndIf 
If tur3()\slot3a=973:
tur3()\reani+2
EndIf 
If tur3()\slot3a=974:
tur3()\gravi+3
EndIf 
If tur3()\slot3a=976:
tur3()\reani+3
EndIf 
If tur3()\slot3a=977:
tur3()\gravi+1
EndIf
If tur3()\slot3a=978:
tur3()\gravi+5
EndIf 
If tur3()\slot3a=979:
tur3()\ataka+3
EndIf 
If tur3()\slot3a=981:
tur3()\trafic5+1
EndIf 
If tur3()\slot3a=984:
tur3()\metko+4
tur3()\ataka+2
tur3()\energ2+2
EndIf 
If tur3()\slot3a=985:
tur3()\ataka+2
tur3()\energ2+5
EndIf 
If tur3()\slot3a=986:
tur3()\gravi+1
tur3()\trafic5+3
EndIf 
If tur3()\slot3a=987:
tur3()\energ2+3
EndIf 



If tur3()\slot4a=970:
tur3()\energ2+1
tur3()\ataka+1
EndIf 
If tur3()\slot4a=972:
tur3()\reani+1
EndIf 
If tur3()\slot4a=973:
tur3()\reani+2
EndIf 
If tur3()\slot4a=974:
tur3()\gravi+3
EndIf 
If tur3()\slot4a=976:
tur3()\reani+3
EndIf 
If tur3()\slot4a=977:
tur3()\gravi+1
EndIf
If tur3()\slot4a=978:
tur3()\gravi+5
EndIf 
If tur3()\slot4a=979:
tur3()\ataka+3
EndIf 
If tur3()\slot4a=981:
tur3()\trafic5+1
EndIf 
If tur3()\slot4a=984:
tur3()\metko+4
tur3()\ataka+2
tur3()\energ2+2
EndIf 
If tur3()\slot4a=985:
tur3()\ataka+2
tur3()\energ2+5
EndIf 
If tur3()\slot4a=986:
tur3()\gravi+1
tur3()\trafic5+3
EndIf 
If tur3()\slot4a=987:
tur3()\energ2+3
EndIf 
Wend 
Return 


instor22:
If kto=970:
tur3()\energ2+1
tur3()\ataka+1
EndIf 
If kto=970:
tur3()\energ2+1
tur3()\ataka+1
EndIf 
If kto=972:
tur3()\reani+1
EndIf 
If kto=973:
tur3()\reani+2
EndIf 
If kto=974:
tur3()\gravi+3
EndIf 
If kto=976:
tur3()\reani+3
EndIf 
If kto=977:
tur3()\gravi+1
EndIf
If kto=978:
tur3()\gravi+5
EndIf 
If kto=979:
tur3()\ataka+3
EndIf 
If kto=981:
tur3()\trafic5+1
EndIf 
If kto=984:
tur3()\metko+4
tur3()\ataka+2
tur3()\energ2+2
EndIf 
If kto=985:
tur3()\ataka+2
tur3()\energ2+5
EndIf 
If kto=986:
tur3()\gravi+1
tur3()\trafic5+3
EndIf 
If kto=987:
tur3()\energ2+3
EndIf 

Return 




minusa:
ResetList( tur3() ) 
While NextElement( tur3())
If tur3()\pnom=play:
If or111=970:
tur3()\energ2-1
tur3()\ataka-1
EndIf 
If or111=970:
tur3()\energ2-1
tur3()\ataka-1
EndIf 
If or111=972:
tur3()\reani-1
EndIf 
If or111=973:
tur3()\reani-2
EndIf 
If or111=974:
tur3()\gravi-3
EndIf 
If or111=976:
tur3()\reani-3
EndIf 
If or111=977:
tur3()\gravi-1
EndIf
If or111=978:
tur3()\gravi-5
EndIf 
If or111=979:
tur3()\ataka-3
EndIf 
If or111=981:
tur3()\trafic5-1
EndIf 
If or111=984:
tur3()\metko-4
tur3()\ataka-2
tur3()\energ2-2
EndIf 
If or111=985:
tur3()\ataka-2
tur3()\energ2-5
EndIf 
If or111=986:
tur3()\gravi-1
tur3()\trafic5-3
EndIf 
If or111=987:
tur3()\energ2-3
EndIf 


EndIf 
Wend 
Return 



;оружие  900-автомат  901-огнемет
; IDE Options = PureBasic 4.30 (Windows - x86)
; CursorPosition = 3886
; FirstLine = 3849
; Folding = -
; EnableXP