egor_2.py

Created by wperez274

Created on September 08, 2022

13.1 KB


#WRITTEN BY: WILSON
from math import *
from random import *
from kandinsky import *
from random import randint as R
from random import choice as CH
from kandinsky import fill_rect as F
from kandinsky import draw_string as STR
from ion import *
from time import *

#******************************************************  
alive=True
gravity=True
p_on_bullet=False
#******************************************************  
bg="white"
fuel=3
#******************************************************  
p_on_platform=True

p_face_left=False
p_face_right=True


ammo=35

shoot_rght=False
shoot_left=False

p_energy=35
px=154
py=170
pw=14
ph=20
pc=(0,0,100)

shoot=False
bull=[0]
bull_y=py+10
bull[0]=px

bull_w=10
bull_h=5

#******************************************************  
gx=0
gy=190
gw=3000
gh=3
gc=(0,100,0)
#ground color
gc_main=CH(['brown','pink','orange','gray'])
#******************************************************  

cl_1_x=gx+R(400,700)
cl_1_y=R(0,50)
cl_1_w=R(35,70)
cl_1_h=R(10,25)
cl_1_c="white"
#******************************************************  
cl_2_x=gx+R(400,700)
cl_2_y=R(0,50)
cl_2_w=R(35,70)
cl_2_h=R(10,25)
cl_2_c="white"
#******************************************************  
bu_x=R(500,700)
bu_y=R(20,150)
bu_w=30
bu_h=12
bu_c='black'
#******************************************************  

bu_2_x=R(500,700)
bu_2_y=R(20,150)
bu_2_w=40
bu_2_h=16
bu_2_c='black'

crit_x=[
gx+R(700,1000),
gx+R(1200,1500),
gx+R(2000,2500),
gx+R(3000,3400),
gx+R(3600,4000),
gx+R(4200,5000)
]

crit_w=25
crit_h=8
crit_y=gy-crit_h

#******************************************************  

lava_x=[
gx+R(800,1000),
gx+R(1100,1300),
gx+R(1400,1600)
]

lava_w=50
lava_h=10
lava_y=gy


#****************
plat_x=[
gx+R(700,900),
gx+R(1200,1500),
gx+R(1700,1900),
gx+R(2200,2400),
gx+R(2600,3500),
gx+R(3800,4200)
]

plat_w=R(400,700)
plat_h=10
plat_y=R(80,120,)
plat_c=(R(0,255),R(0,255),R(0,255))

#****************

#******************************************************  
r_1_x=gx+R(250,500)
r_1_w=gx+R(100,500)
r_1_h=gx+R(40,120)
r_1_y=gy-r_1_h
r_1_c=CH(['blue','red',
'green','yellow','brown',
'black','orange','purple'
])

#******************************************************  
area_x=[
gx+1500,
gx+2500,
gx+4500
]
#******************************************************  
F(0,0,322,222,bg)
F(0,190,322,5,(0,R(50,255),0))
#******************************************************  

game=True

while p_energy>0:
  F(0,190,322,2,(0,100,0))
  F(0,193,322,1000,gc_main)
  F(gx+r_1_x,gy-r_1_h,r_1_w,r_1_h,r_1_c)
#******************************************************  
#RECT OUTLINE
  F(gx+r_1_x,r_1_y,2,r_1_h,"black")
  F(gx+r_1_x+r_1_w-2,r_1_y,2,r_1_h,"black")
  F(gx+r_1_x,r_1_y,r_1_w,2,"black")
  F(gx+r_1_x,r_1_y+r_1_h-2,r_1_w,2,"black")
#******************************************************  
#erase
  F(gx+r_1_x-3,gy-r_1_h,3,r_1_h,bg)
  F(gx+r_1_x+r_1_w+1,gy-r_1_h,3,r_1_h,bg)
#******************************************************  
  F(gx+lava_x[0],lava_y,lava_w,lava_h,"red")
  F(gx+lava_x[1],lava_y,lava_w,lava_h,"red")
  F(gx+lava_x[2],lava_y,lava_w,lava_h,"red")

#******************************************************  


  F(gx+plat_x[0],plat_y,plat_w,plat_h,plat_c)
  F(gx+plat_x[1],plat_y,plat_w,plat_h,plat_c)
  F(gx+plat_x[2],plat_y,plat_w,plat_h,plat_c)
  F(gx+plat_x[3],plat_y,plat_w,plat_h,plat_c)
  F(gx+plat_x[4],plat_y,plat_w,plat_h,plat_c)
  F(gx+plat_x[5],plat_y,plat_w,plat_h,plat_c)
  
#erase left right trail

  F(gx+plat_x[0]-3,plat_y,3,plat_h,bg)
  F(gx+plat_x[1]-3,plat_y,3,plat_h,bg)
  F(gx+plat_x[2]-3,plat_y,3,plat_h,bg)
  F(gx+plat_x[3]-3,plat_y,3,plat_h,bg)
  F(gx+plat_x[4]-3,plat_y,3,plat_h,bg)
  F(gx+plat_x[5]-3,plat_y,3,plat_h,bg)
 
 
  F(gx+plat_x[0]+plat_w+1,plat_y,3,plat_h,bg)
  F(gx+plat_x[1]+plat_w+1,plat_y,3,plat_h,bg)
  F(gx+plat_x[2]+plat_w+1,plat_y,3,plat_h,bg)
  F(gx+plat_x[3]+plat_w+1,plat_y,3,plat_h,bg)
  F(gx+plat_x[4]+plat_w+1,plat_y,3,plat_h,bg)
  F(gx+plat_x[5]+plat_w+1,plat_y,3,plat_h,bg)

#*****************************
  F(gx+crit_x[0],gy-crit_h,crit_w,crit_h,"black")
  F(gx+crit_x[1],gy-crit_h,crit_w,crit_h,"black")
  F(gx+crit_x[2],gy-crit_h,crit_w,crit_h,"black")
  F(gx+crit_x[3],gy-crit_h,crit_w,crit_h,"black")
  F(gx+crit_x[4],gy-crit_h,crit_w,crit_h,"black")
  F(gx+crit_x[5],gy-crit_h,crit_w,crit_h,"black")
 
  F(gx+crit_x[0]-3,gy-crit_h,3,crit_h,bg)
  F(gx+crit_x[0]+crit_w+1,gy-crit_h,3,crit_h,bg)
 
  F(gx+crit_x[1]-3,gy-crit_h,3,crit_h,bg)
  F(gx+crit_x[1]+crit_w+1,gy-crit_h,3,crit_h,bg)
 
  F(gx+crit_x[2]-3,gy-crit_h,3,crit_h,bg)
  F(gx+crit_x[2]+crit_w+1,gy-crit_h,3,crit_h,bg)
 
  F(gx+crit_x[3]-3,gy-crit_h,3,crit_h,bg)
  F(gx+crit_x[3]+crit_w+1,gy-crit_h,3,crit_h,bg)
 
  F(gx+crit_x[4]-3,gy-crit_h,3,crit_h,bg)
  F(gx+crit_x[4]+crit_w+1,gy-crit_h,3,crit_h,bg)
 
  F(gx+crit_x[5]-3,gy-crit_h,3,crit_h,bg)
  F(gx+crit_x[5]+crit_w+1,gy-crit_h,3,crit_h,bg)

#crit_x[0] eyes
  F(crit_x[0]+3,gy-crit_h+3,10,5,"red")  
#*****************************
#DIFFERENT AREAS
  F(gx+area_x[0],0,1000,190,"black")
  F(gx+area_x[1],0,2000,190,"orange")
  F(gx+area_x[2],0,3000,190,"pink")

#*****************************

#***[ PLAYER TELEPORTS TO ]***
# A NEW WORLD OR DIMENSION!!
  if px>=gx+area_x[2]+2000:
    from egor_1 import *
    


#*****************************
  F(gx+area_x[0],0,3,190,"blue")
  F(gx+area_x[0]-3,0,3,190,bg)
  F(gx+area_x[0]+1000+1,0,3,190,bg)

#*****************************
#////PLAYER/////
  F(px,py,pw,ph,pc)
#player OUTLINE
  F(px,py,1,ph,"black")
  F(px+pw-1,py,1,ph,"black")
  F(px,py,pw,1,"black")
  F(px,py+ph-1,pw,1,"black")
#PLAYER FACE/SKIN
  F(px+2,py+4,10,4,"orange")
#player eyes
  F(px+4,py+5,2,2,"black")
  F(px+9,py+5,2,2,"black")
#player mouth
  F(px+3,py+9,8,1,"black")
#player footware
  F(px,py+ph-2,pw,2,"brown")

#**************************
#PLAYER ON DIFFERENT PLATFORMS
  for i in plat_x:
    if px+pw>=gx+i and px<=gx+i+plat_w and py+ph>=plat_y and py<=plat_y+2:
      py=plat_y-ph
      p_on_platform=True
      fuel=3


#******************************************************  
# i is lava x values (locations)
# for each lava point. 
  for i in lava_x:
    if px+pw>=gx+i and px<=gx+i+lava_w and py+ph>=lava_y and py<=lava_y+lava_h:
      F(px,py,pw,ph,"red")
      p_energy-=0.1
      sleep(0.005)  
#******************************************************  

  for i in lava_x:
    F(gx+i+lava_w+1,0,2,lava_h,bg)
    F(gx+i-2,0,2,lava_h,bg)

#******************************************************  



  for i in crit_x:
    if px+pw>=gx+i and px<=gx+i+crit_w and py+ph>=crit_y and py<=crit_y+crit_h:
      F(px,py,pw,ph,"red")
      p_energy-=0.1
      
      F(px,py-8,round(p_energy/2),4,"red")
      F(px+round(p_energy/2),py-8,2,4,bg)
      
      F(px,py-8,round(p_energy/2),1,"black")
      F(px,py-8+4-1,round(p_energy/2),1,"black")
      
#******************************************************  
  bu_x-=2
  bu_2_x-=2


#SHOW BULLET
  F(bu_x,bu_y,bu_w,bu_h,bu_c)
  F(bu_x+5,bu_y+5,8,4,"red")
  F(bu_x+bu_w,bu_y,3,bu_h,bg)
#BULLET OUTLINE
  F(bu_x,bu_y,1,bu_h,"blue")
  F(bu_x+bu_w-1,bu_y,1,bu_h,"blue")
  F(bu_x,bu_y,bu_w,1,"blue")
  F(bu_x,bu_y+bu_h-1,bu_w,1,"blue")
#******************************************************  
#RANDOMIIZE BULLET..  
  if bu_x+bu_w<0-R(20,80):
    bu_x=R(500,600)
    bu_y=py


#SHOW BULLET 2
  F(bu_2_x,bu_2_y,bu_2_w,bu_2_h,bu_2_c)
  F(bu_2_x+5,bu_2_y+5,8,4,"green")
  F(bu_2_x+bu_2_w,bu_2_y,3,bu_2_h,bg)

  F(bu_2_x,bu_2_y,1,bu_2_h,"magenta")
  F(bu_2_x+bu_2_w-1,bu_2_y,1,bu_2_h,"magenta")
  F(bu_2_x,bu_2_y,bu_2_w,1,"magenta")
  F(bu_2_x,bu_2_y+bu_2_h-1,bu_2_w,1,"magenta")


#RANDOMIIZE BULLET 2  
  if bu_2_x+bu_2_w<0-R(20,50):
    bu_2_x=R(600,800)
    bu_2_y=py

#******************************************************  
#///PAUSE GAME/////    
  if keydown(KEY_OK):
    while not keydown(KEY_VAR):
      draw_string("< PAUSED >",110,0)
      draw_string("[ Press [VAR] to resume ]",30,20)
      draw_string("Your Location:"+str(px-gx)+","+str(py+ph),40,60)
    draw_string("          ",110,0,bg,bg)
    draw_string("                         ",30,20,bg,bg)
    draw_string("Your Location:          ",40,60,bg,bg)
#******************************************************  

#player bends down or 
  if keydown(KEY_DOWN):# and p_on_platform:
    F(px,py-10,pw,10,bg)
    ph=10
    py+=1
  else:
    ph=20
  if py+ph>=gy:
    py=gy-ph
#******************************************************  
  if keydown(KEY_BACKSPACE) and fuel>0:
    F(px,py+ph+1,pw,4,bg)
    py-=4
    fuel-=0.048
#******************************************************  
  if fuel<=0:
    fuel=0
#******************************************************  
  if py+ph>=190:
    p_on_platform=True
    fuel=3
  if gravity:
    py+=2
    F(px,py-2,pw,2,bg)
#******************************************************  
  if px+pw>=bu_x and px<=bu_x+bu_w and py+ph>=bu_y and py<=bu_y+bu_h:
    F(px,py,pw,ph,"red")
    F(px+pw,py,3,ph,bg)
    p_energy-=0.2
    px-=2
    
#******************************************************  
  if px+pw>=bu_x and px<=bu_x+bu_w and py+ph>=bu_y and py+ph<=bu_y+2:
    py=bu_y-ph
    p_on_platform=True
    fuel=3
    F(px+pw+1,py,2,ph,bg)
    p_on_bullet=True
  else:
    p_on_bullet=False


  if px+pw>=bu_2_x and px<=bu_2_x+bu_2_w and py+ph>=bu_2_y and py<=bu_2_y+bu_2_h:
    F(px,py,pw,ph,(120,0,0))
    F(px+pw,py,3,ph,bg)
    p_energy-=0.2
    px-=3

  if px+pw>=bu_2_x and px<=bu_2_x+bu_2_w and py+ph>=bu_2_y and py+ph<=bu_2_y+2:
    py=bu_2_y-ph
    p_on_platform=True
    fuel=3
    F(px+pw+1,py,2,ph,bg)
    p_on_bullet=True
  else:
    p_on_bullet=False
#******************************************************  
  if px+pw>=gx+r_1_x and px<=gx+r_1_x+r_1_w and py+ph>=r_1_y and py+ph<=r_1_y+2:
    py=r_1_y-ph
    p_on_platform=True
    fuel=3
#******************************************************  
  if keydown(KEY_LEFT):
    px-=3
    F(px+pw,py,3,ph,bg) 
    p_face_left=True
    p_face_right=False
    
  if keydown(KEY_RIGHT):
    px+=3
    F(px-3,py,3,ph,bg)
    p_face_right=True
    p_face_left=False
    
#******************************************************  
  if keydown(KEY_LEFT) and keydown(KEY_TOOLBOX):
    px-=5
    F(px+pw+1,py,5,ph,bg)
#******************************************************  
  if keydown(KEY_RIGHT) and keydown(KEY_TOOLBOX):
    px+=5
    F(px-5,py,5,ph,bg)    
#******************************************************  
  if keydown(KEY_LEFT) and px<154:
    px=154
    gx+=3
#******************************************************  
  if keydown(KEY_RIGHT) and px+pw>=168:
    px=168-pw
#    F(px+pw,py,3,ph,bg)
    gx-=3
#******************************************************  
#limit to the left
  if px<=gx-300:
    px=gx-300
    F(gx-300,0,2,190,"cyan")
    while not keydown(KEY_RIGHT):
      STR("You are not ready for",4,20)
      STR("what is beyond here..",4,40)
      STR("A wise man named Rygar will",4,60)
      STR("guide you. He lives in a",4,80)
      STR("village Eastward..",4,100)
    STR("                     ",4,20,bg,bg)
    STR("                     ",4,40,bg,bg)
    STR("                           ",4,60,bg,bg)
    STR("                         ",4,80,bg,bg)
    STR("                    ",4,100,bg,bg)
    F(gx-300,0,2,190,bg)
    px=gx-297
#******************************************************  
  if px<=120 and p_on_bullet:
    px=120
    gx+=3
#******************************************************  
  if px+pw>=200 and p_on_bullet:
    px=200-pw
    gx-=3
#******************************************************  
  if py+ph<190:
    p_on_platform=False
#***************************
#CLOUD 1
  F(cl_1_x,cl_1_y,cl_1_w,cl_1_h,cl_1_c)
  F(cl_1_x+cl_1_w+1,cl_1_y,2,cl_1_h,bg)
#******************************************************  
#CLOUD 1 outline
  F(cl_1_x,cl_1_y,2,cl_1_h,"cyan")
  F(cl_1_x+cl_1_w-2,cl_1_y,2,cl_1_h,"cyan")
  F(cl_1_x,cl_1_y,cl_1_w,2,"cyan")
  F(cl_1_x,cl_1_y+cl_1_h-2,cl_1_w,2,"cyan")
#******************************************************  
#CLOUD moves
  cl_1_x-=CH([0,1,2])
  
  if cl_1_x+cl_1_w<0-R(20,50):
    cl_1_x=R(400,500)
    cl_1_y=R(0,60)
    cl_1_w=R(30,70)
    cl_1_h=R(10,30)
#******************************************************  
#CLOUD 2
  F(cl_2_x,cl_2_y,cl_2_w,cl_2_h,cl_2_c)
  F(cl_2_x+cl_2_w+1,cl_2_y,2,cl_2_h,bg)
#******************************************************  
#CLOUD 2 outline
  F(cl_2_x,cl_2_y,2,cl_2_h,"cyan")
  F(cl_2_x+cl_2_w-2,cl_2_y,2,cl_2_h,"cyan")
  F(cl_2_x,cl_2_y,cl_2_w,2,"cyan")
  F(cl_2_x,cl_2_y+cl_2_h-2,cl_2_w,2,"cyan")
#******************************************************  
#CLOUD 2 moves
  cl_2_x-=CH([0,1])
#******************************************************  
  if cl_2_x+cl_2_w<0-R(20,50):
    cl_2_x=R(400,500)
    cl_2_y=R(0,60)
    cl_2_w=R(30,60)
    cl_2_h=R(10,20)
#******************************************************    
  crit_x[0]-=CH([-2,-1,1])
  crit_x[1]-=CH([-1,1,2])
  crit_x[2]-=CH([-2,1])
  crit_x[3]-=CH([-2,-1,1])
  crit_x[4]-=CH([-1,1,2])
  crit_x[5]-=CH([-2,1])

  if keydown(KEY_TOOLBOX) and ammo>0 and p_face_right:
    F(px+pw+1,py+9,20,3,"black")
    F(px+pw+8,py+7,2,8,"gray")
    sleep(0.01)
    F(px+pw+1,py+9,20,3,bg)
    F(px+pw+8,py+7,2,8,bg)

  F(gx+plat_x[0],plat_y,2,plat_h,"black")
  F(gx+plat_x[0]+plat_w-2,plat_y,2,plat_h,"black")
  F(gx+plat_x[0],plat_y,plat_w,2,"black")
  F(gx+plat_x[0],plat_y+plat_h-2,plat_w,2,"black")

F(0,0,322,222,"black")

STR("GAME OVER",100,100,"orange","black")

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.