
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

   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





  
  
  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 (553, "harak/vudra_die_0004.png",#PB_Sprite_Texture )
LoadSprite (554, "harak/vudra_die_0005.png",#PB_Sprite_Texture )
LoadSprite (555, "harak/vudra_die_0006.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 (561, "harak/2/vudra_die_0004.png",#PB_Sprite_Texture )
LoadSprite (562, "harak/2/vudra_die_0005.png",#PB_Sprite_Texture )
LoadSprite (563, "harak/2/vudra_die_0006.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 (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 (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 (1000, "gfx/str1.png",#PB_Sprite_Texture )
LoadSprite (1001, "gfx/str2.png",#PB_Sprite_Texture )
LoadSprite (1002, "gfx/str2.png",#PB_Sprite_Texture )
LoadSprite (1003, "gfx/str3.png",#PB_Sprite_Texture )
LoadSprite (1004, "gfx/str4.png",#PB_Sprite_Texture )
LoadSprite (1005, "gfx/str5.png",#PB_Sprite_Texture )
LoadSprite (1006, "gfx/str6.png",#PB_Sprite_Texture )
LoadSprite (1007, "gfx/str7.png",#PB_Sprite_Texture )
LoadSprite (1008, "gfx/str8.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 (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(961, 961)
CreateSprite3D(962, 962)

CreateSprite3D(1000, 1000)
CreateSprite3D(1001, 1001)
CreateSprite3D(1002, 1002)
CreateSprite3D(1003, 1003)
CreateSprite3D(1004, 1004)
CreateSprite3D(1005, 1005)
CreateSprite3D(1006, 1006)
CreateSprite3D(1007, 1007)
CreateSprite3D(1008, 1008)
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=128-10:EndIf ; razmer lokacii
If yraz=600:razmer=129:EndIf
If yraz=486:razmer=128+10:EndIf
c=0:d=0
obx=10
chet=0
obx2=0
   xti=0
   yti=0
   
play=1
players=4
players2=4
Structure Person
    x.w
    y.w
    x2.w
    y2.w
    nom.w
    swo.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
  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
    name$ ;    максимум 10 букв
    energ.w
    energ1.w
    energ2.w
    color.l
    slot1.w
    slot2.w
    slot3.w
    slot4.w
    slot5.w
    slot6.w
    slot7.w
    slot8.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
  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 ()


  iko=10

okno=0

 AddElement( tur3() )
  tur3()\pnom=1
  tur3()\money=999999
    tur3()\opyt=999998
    tur3()\trafic=32
  tur3()\trafic2=32
     tur3()\trafic3=2
         tur3()\trafic4=2
           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=905
    tur3()\slot7=910
    tur3()\slot8=909

         AddElement( tur3() )
  tur3()\pnom=2
  tur3()\money=999999
    tur3()\opyt=999998
    tur3()\trafic=32
  tur3()\trafic2=32
     tur3()\trafic3=2
         tur3()\trafic4=2
           tur3()\name$="Gipno Jaba"
        tur3()\energ=64
          tur3()\energ1=4
          tur3()\energ2=4
        tur3()\color=RGB(200,200,255) 
    tur3()\slot1=900
    tur3()\slot2=902
    tur3()\slot3=906
    tur3()\slot4=908
    tur3()\slot5=907
    tur3()\slot6=906
    tur3()\slot7=0
    tur3()\slot8=0

              AddElement( tur3() )
  tur3()\pnom=3
  tur3()\money=999999
    tur3()\opyt=999998
    tur3()\trafic=32
  tur3()\trafic2=32
     tur3()\trafic3=2
         tur3()\trafic4=2
           tur3()\name$="Gipno Jaba2"
        tur3()\energ=64
          tur3()\energ1=4
          tur3()\energ2=4
        tur3()\color=RGB(200,200,255) 
    tur3()\slot1=900
    tur3()\slot2=902
    tur3()\slot3=906
    tur3()\slot4=908
    tur3()\slot5=907
    tur3()\slot6=906
    tur3()\slot7=0
    tur3()\slot8=0
                   AddElement( tur3() )
  tur3()\pnom=4
  tur3()\money=999999
    tur3()\opyt=999998
    tur3()\trafic=32
  tur3()\trafic2=32
     tur3()\trafic3=2
         tur3()\trafic4=2
           tur3()\name$="Gipno Jaba2"
        tur3()\energ=64
          tur3()\energ1=4
          tur3()\energ2=4
        tur3()\color=RGB(200,200,255) 
    tur3()\slot1=900
    tur3()\slot2=902
    tur3()\slot3=906
    tur3()\slot4=908
    tur3()\slot5=907
    tur3()\slot6=906
    tur3()\slot7=0
    tur3()\slot8=0

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

Gosub print2

Gosub gravitacija

Gosub print
Gosub print4
Gosub print3
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 ikon
Gosub mouse

         
                               
  ElapsedTime.f = ElapsedMilliseconds()-StartTime.f
Debug  ElapsedTime.f

 StartDrawing( ScreenOutput())
DrawText(10,10 , Str(ElapsedTime.f), RGB((255),(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:
If anim2>0:Return:EndIf
anistr+1
If anistr=9:anistr=0:EndIf 
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:
;---------------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=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=910 And stena=0:stena=1:EndIf
If xm33>tur()\x:tur()\stor=0:EndIf 
If xm33<tur()\x:tur()\stor=1:EndIf 
Return 

fire2:
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=910 And stena=0:stena=1:EndIf
If xm33>tur()\x:tur()\stor=0:EndIf 
If xm33<tur()\x:tur()\stor=1:EndIf 
Return 
 
 
  pulqq3:
 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(2)
tur5()\met2=Random(2)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(16)
 Return 
    pulqq5:
 spidf=1
 AddElement( tur5() )
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-70
tur5()\met=1+Random(1);storona
tur5()\met2=Random(1)+1;chastota
tur5()\met3=tur5()\met2;
tur5()\met4=Random(3);pixel
 Return 
 
 
     pulqq6:
 spidf=1
 AddElement( tur5() )
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
 Return 
 
      pulqq66:
 spidf=1
 AddElement( tur5() )
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
 Return 
 
   pulqq4:
 spidf=1
 AddElement( tur5() )
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)
 Return 
 
 
 
 
 
 
 
 xm33=xm
ym33=ym
 
  pulqq09:
 spidf=0
 AddElement( tur5() )
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 xm33<tur()\x:tur5()\x=tur()\x-64:EndIf 
If xm33>tur()\x:tur5()\x=tur()\x+64:EndIf 
tur5()\nom=10
tur5()\met=Random(0)
tur5()\met2=Random(0)
tur5()\met3=tur5()\met2
tur5()\met4=Random(0)
 Return 
 
 
 
 
 
 
 
 
 pulqq:
 spidf=0
 AddElement( tur5() )
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(2)
tur5()\met2=Random(3)+1
tur5()\met3=tur5()\met2
tur5()\met4=Random(8)
 Return 
 razrw:
  spidf=2
 AddElement( tur5() )
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(2);storona
tur5()\met2=Random(10)+1;chastota
tur5()\met3=tur5()\met2;
tur5()\met4=Random(1);pixel
tur5()\zap=1
 Return 
moik:
ExamineMouse() 
If MouseButton(1):
iko=0
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:


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:
If weapon=901:Return:EndIf 
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 
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=10 And tur5()\x >tur5()\xx:tur5()\x+100:kuda=0:EndIf 
If tur5()\nom=10 And tur5()\x <tur5()\xx:tur5()\x-100:kuda=1:EndIf  

If tur5()\nom=3 And tur5()\x >tur5()\xx:tur5()\x+20:kuda=0:EndIf 
If tur5()\nom=3 And tur5()\x <tur5()\xx:tur5()\x-20: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 
ymd=tur5()\y
xmd=tur5()\x
anal=15
If tur5()\nom=10:anal=0:EndIf 
ResetList( tur() ) 
While NextElement( tur())
 If SpritePixelCollision(1, xmd, ymd-anal, tur()\nom, tur()\x, tur()\y):Goto popal:EndIf
 If anal=0 And SpriteCollision(1, xmd, ymd-anal, tur()\nom, tur()\x, tur()\y):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:
If tur5()\nom=10 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:Gosub wzryw:DeleteElement( tur5() ):Return:EndIf; ------------отнял 
Goto nn:


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

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

otnqtx:;-----------------------minus energijq
Repeat
tur()\energ1-1
If tur()\energ1<=0:tur()\energ1=tur()\energ2:tur()\energ-1:EndIf 
a-1
 Until a=0 
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
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
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
Gosub otnqtx
EndIf 
NextElement( tur())
If tur()\nom=97:;--------------------энерция попал
If tur()\wani<48:tur()\wani=48:EndIf 
If kuda=0:tur()\iner=16:EndIf 
If kuda=1:tur()\iner2=16: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 



nnnn:
Wend
Return 
popall: 
If tur()\nom=500:Goto popalll:EndIf 
Return 
popalll:
NextElement( tur())
If kudaa=0:tur()\iner=8+Random(48):EndIf 
If kudaa=1:tur()\iner2=8+Random(48):EndIf
If kudaa=3:tur()\iner=8:EndIf 
If kudaa=4:tur()\iner2=8:EndIf
If kudaa=2:tur()\gravitator=20+Random(100):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=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 
a111:
ExamineKeyboard()
If KeyboardPushed(#PB_Key_1):
Goto a111:EndIf 
ResetList( tur() ) 

 While NextElement( tur())
If tur()\nom=97 And tur()\iner=0 And tur()\swo=play:
tur()\iner=32
tur()\x2=tur()\x
:EndIf 
Wend
Return 

a222:
ResetList( tur() ) 
 While NextElement( tur())
If tur()\nom=97 And tur()\gravitator=0 And tur()\swo=play:
tur()\gravitator=70:
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:


Gosub prp


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<128+96:c+16::push=1:EndIf  
If KeyboardPushed(#PB_Key_Right) And c>-2350: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>-2200:d-16:push=1: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 
If KeyboardPushed(#PB_Key_1):
Goto a111
: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:Gosub 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 
ikonka:
ExamineMouse() 
If MouseButton(1):
If or1>0 And level2=0:level=level2:weapon=tur3()\slot1:EndIf 
If or2>0 And level2=32:level=level2:weapon=tur3()\slot2:EndIf 
If or3>0 And level2=64:level=level2:weapon=tur3()\slot3:EndIf 
If or4>0 And level2=96:level=level2:weapon=tur3()\slot4:EndIf 
If or5>0 And level2=128:level=level2:weapon=tur3()\slot5:EndIf 
If or6>0 And level2=160:level=level2:weapon=tur3()\slot6:EndIf 
If or7>0 And level2=192:level=level2:weapon=tur3()\slot7:EndIf 
If or8>0 And level2=224:level=level2:weapon=tur3()\slot8:EndIf 
If level2=225:level2=0:nextpl=1:EndIf 
tur3()\kakoj=level2
EndIf 

StartDrawing( ScreenOutput())
DrawingMode(#PB_2DDrawing_XOr )
If 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:EndIf 
If xm3>52 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:EndIf 
If xm3>84 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:EndIf 
If xm3>116 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:EndIf 
If xm3>148 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:EndIf 
If xm3>180 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:EndIf 
If xm3>212 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:EndIf 
If xm3>244 And xm3<244+32 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:EndIf 

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)):level2=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)):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)):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)):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)):EndIf 

StopDrawing() 
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:

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(1)=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:
:DisplaySprite3D( tur4()\nom , tur4()\x + c, tur4()\y + d, tur4()\life*10 ):
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 weapon=906 And tur()\wani=25:Gosub pulqq6:EndIf 
If weapon=908 And tur()\wani=25:Gosub pulqq66:Gosub pulqq66:Gosub pulqq66:Gosub pulqq66:EndIf 
If weapon=905 And tur()\wani=71:Gosub pulqq5:EndIf 
If weapon=907 And tur()\wani=71:Gosub pulqq5:Gosub pulqq5:Gosub pulqq5:Gosub pulqq5:EndIf 
If weapon=904 And tur()\wani=25:Gosub pulqq4:EndIf 
If weapon=903 And tur()\wani=>22:Gosub pulqq3:EndIf 
 If weapon=902 And tur()\wani=25:Gosub razrw:EndIf 
 If weapon=901 And tur()\wani>20:Gosub ognem:EndIf 
If weapon=900 And tur()\wani=25:Gosub pulqq:EndIf 
If weapon=909 And tur()\wani=25:Gosub pulqq09: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=>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 :DisplayTransparentSprite(500+tur()\wani , tur()\x + c, tur()\y + d-18):EndIf 
If tur()\stor=1 And tur()\wani=>64 :DisplayTransparentSprite(500+tur()\wani+12 , tur()\x + c+5, tur()\y + d-18):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_Element3 = @tur()
   ResetList( tur() ) 
   While NextElement( tur())
  If  tur()\nom=>9 And tur()\nom<=32 And SpriteCollision(21, xmz, ymz, tur()\nom, tur()\x, tur()\y):
:kras=1:
  :EndIf 
  Wend

  ChangeCurrentElement(tur(), *Old_Element3)
  
  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_Element2 = @tur()
   ExamineMouse() 
   xmz = MouseX()                         
   ymz = MouseY() 
   xmz-c:ymz-d
   xmz/48:xmz*48
   ymz/48:ymz*48
   wanim=10

  AddElement( tur() ) 
  tur()\x = xmz
  tur()\y = ymz
  tur()\nom = 21
  AddElement( tur() ) 
  tur()\x = xmz
  tur()\y = ymz
  tur()\nom = 96
  sl:
ChangeCurrentElement(tur(), *Old_Element2)

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
DisplaySprite3D(1000+anistr , tur()\x + c+a-8, tur()\y + d-b+18+stry,255)
EndIf 
StartDrawing( ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent )
ff=StringByteLength(tur()\name$)
DrawText(tur()\x + c+a-(ff*2)+1,tur()\y + d-b+38+stry , tur()\name$, RGB(0,0,0))
DrawText(tur()\x + c+a-(ff*2)-1,tur()\y + d-b+38+stry , tur()\name$, RGB(0,0,0))
DrawText(tur()\x + c+a-(ff*2),tur()\y + d-b+38+stry , tur()\name$, tur()\color )
    ff= tur()\energ+2
   Box(tur()\x + c+a-(ff/2), tur()\y + d-b+55+stry, tur()\energ+2,5, RGB(0, 0, 0))
   Box(tur()\x + c+a-(ff/2)+1, 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 
     StopDrawing() 
Stop3D()
Return 


inercijaa:
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 

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


Gosub inercija
wanim=0

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

If tur()\wani=>48:tur()\wani+1:EndIf 
If tur()\wani=>52 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: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=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=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 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:
If tur()\nom=67 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x-spi, tur()\y+1)=1::
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:
If tur()\nom=67 And SpriteCollision(97, xww, yww, tur()\nom, tur()\x+spi, tur()\y+1)=1::
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/tur1.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()\opyt:cq=tur3()\money: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:weapon=tur3()\slot1:EndIf 
If level=32:weapon=tur3()\slot2:EndIf
If level=64:weapon=tur3()\slot3:EndIf
If level=96:weapon=tur3()\slot4:EndIf
If level=128:weapon=tur3()\slot5:EndIf
If level=160:weapon=tur3()\slot6:EndIf
If level=192:weapon=tur3()\slot7:EndIf
If level=224:weapon=tur3()\slot8:EndIf


;If tur3()\slot8>0:level=224:weapon=tur3()\slot8:EndIf 
;If tur3()\slot7>0:level=196:weapon=tur3()\slot7:EndIf 
;If tur3()\slot6>0:level=160:weapon=tur3()\slot6:EndIf 
;If tur3()\slot5>0:level=128:weapon=tur3()\slot5:EndIf 
;If tur3()\slot4>0:level=96:weapon=tur3()\slot4:EndIf 
;If tur3()\slot3>0:level=64:weapon=tur3()\slot3:EndIf 
;If tur3()\slot2>0:level=32:weapon=tur3()\slot2:EndIf 
;If tur3()\slot1>0:level=0:weapon=tur3()\slot1:EndIf 
igroplay+1
  :EndIf 
  DisplayTransparentSprite (7, 19+level, yraz-103-6)

or1=0:or2=0:or3=0:or4=0
or5=0:or6=0:or7=0:or8=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 
DisplayTransparentSprite(911,230+70,yraz-47)
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:EndIf 
If tur3()\trafic=0:Goto nextplay:EndIf ;-----------------передал ход
Return 

nextplay:
tur3()\trafic=tur3()\trafic2

igroplay=0
ResetList( tur() ) 
While NextElement( tur())
If tur()\nom=97 Or tur()\nom=500:tur()\x2=tur()\x:tur()\y2=tur()\y:tur()\wani=0:EndIf 
Wend
play+1
players-1
push=0
If players=0:players=players2:play=1:EndIf 
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:
ZoomSprite3D(tur6()\spr+tur6()\kris, tur6()\degr+32, tur6()\degr+32)
Start3D()
Sprite3DBlendingMode(10, 7)
DisplaySprite3D(tur6()\spr+tur6()\kris ,  tur6()\x+c, tur6()\y+d,255)
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:Gosub otnqtx: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 


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