egor_1.py

Created by wperez274

Created on September 08, 2022

10.5 KB


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

REMIND=None

rem=input("\n\nSet Reminder?\n\n   1) Yes       2) No\n\n")

if rem=="1" or rem=="w" or rem=="W":
  REMIND=True
  note=input("\nREMINDER?\n\n")
else:
  rem==False
  

#screen width 
SW=322
#screen height
SH=222

game=True
gravity=True
jump=False
p_on_platform=True

T=300
jump_height=10

bg=(200,255,255)
#/////////[IMPORTANT]//////////
#GAME MAP [0,210]
gx=0
gy=210
gw=10**4
gh=12
gc="brown"
#///////////////////
area=1
#//Player/////////////////
p_energy=35
p_score=0
px=154
py=gy-35
pw=16
ph=35
pc="orange"
p_right=True
p_left=False
#////////////////////////
#PLATFORMS
rectx=gx+R(250,400)
rectw=R(70,120)
recth=R(12,18)
recty=gy-R(140,160)

rectc="red"#choice(['blue','red','green','yellow','brown','white','pink','orange','purple','gray'])
rect_2_x=gx+R(400,500)
rect_2_w=R(40,80)
rect_2_h=R(20,50)
rect_2_y=185-rect_2_h
rect_2_c="white"#choice(['blue','red','green','yellow','brown','white','pink','orange','purple','gray'])

rect_3_x=gx+R(600,700)
rect_3_y=R(140,180)
rect_3_w=R(25,50)
rect_3_h=R(40,100)
rect_3_y=R(140,180)
rect_3_c="blue"#(R(0,255),R(0,255),R(0,255))

rect_4_x=gx+R(700,800)
rect_4_y=gy-R(120,170)
rect_4_w=40
rect_4_h=10
rect_4_c="gray"

lava_x=900
lava_y=gy-12
lava_w=SW*6
lava_h=25
lava_c=(140,0,0)

area_x=[
gx+2500,
gx+3500,
gx+5500
]





cloud_1_x=gx+R(300,500)
cloud_1_y=25
cloud_1_w=R(35,60)
cloud_1_h=R(8,20)
cloud_1_c="white"

cloud_2_x=R(500,700)
cloud_2_y=25
cloud_2_w=R(35,60)
cloud_2_h=R(8,20)
cloud_2_c="white"

cloud_3_x=gx+R(800,1000)
cloud_3_y=25
cloud_3_w=R(35,60)
cloud_3_h=R(8,20)
cloud_3_c="white"


bullet_x=R(500,700)
bullet_y=R(20,150)
bullet_w=40
bullet_h=20
bullet_c="black"


def PrintData():
  global p_energy,p_score,area
  
  draw_string("Energy:",2,2)
  F(75,4,round(p_energy),10,"red")
  F(75+round(p_energy),4,1,10,bg)
  draw_string(chr(36)+str(p_score),160,2,(0,55,0))
  draw_string("Area:"+str(area),250,2)

F(0,0,322,222,bg)
F(gx,gy-2,gw,3,"blue")
while 1:
#clouds float West..  
  cloud_1_x-=choice([0,0,1])
  cloud_2_x-=choice([0,0,1])
  cloud_3_x-=choice([0,0,1])
#////SHOW clouds/////

#CLOUD 1
  F(cloud_1_x,cloud_1_y,1,cloud_1_h,cloud_1_c)

# cloud 1 outline
  F(cloud_1_x+cloud_1_w-2,cloud_1_y,2,cloud_1_h,"cyan")
  F(cloud_1_x,cloud_1_y,cloud_1_w,2,"cyan")
  F(cloud_1_x,cloud_1_y+cloud_1_h-2,cloud_1_w,2,"cyan")

#CLOUD 2
  F(cloud_2_x,cloud_2_y,1,cloud_2_h,cloud_2_c)
# cloud 2 outline
  F(cloud_2_x+cloud_2_w-2,cloud_2_y,2,cloud_2_h,"cyan")
  F(cloud_2_x,cloud_2_y,cloud_2_w,2,"cyan")
  F(cloud_2_x,cloud_2_y+cloud_2_h-2,cloud_2_w,2,"cyan")
#CLOUD 3
  F(cloud_3_x,cloud_3_y,1,cloud_3_h,cloud_3_c)
# cloud 3 outline
  F(cloud_3_x+cloud_3_w-2,cloud_3_y,2,cloud_3_h,"cyan")
  F(cloud_3_x,cloud_3_y,cloud_3_w,2,"cyan")
  F(cloud_3_x,cloud_3_y+cloud_3_h-2,cloud_3_w,2,"cyan")
#Erase all 3 cloud trails..  
  F(cloud_1_x+cloud_1_w,cloud_1_y,1,cloud_1_h,bg)
  F(cloud_2_x+cloud_2_w,cloud_2_y,1,cloud_2_h,bg)
  F(cloud_3_x+cloud_3_w,cloud_3_y,1,cloud_3_h,bg)
#Randomize clouds size,
#measurements and locations..
  if cloud_1_x+cloud_1_w<=0-R(50,100):
    cloud_1_x=R(400,600)
    cloud_1_y=R(20,60)
    cloud_1_w=R(40,70)
    cloud_1_h=R(20,40)
  if cloud_2_x+cloud_2_w<=0-R(50,100):
    cloud_2_x=R(600,800)
    cloud_2_y=R(20,60)
    cloud_2_w=R(40,70)
    cloud_2_h=R(20,40)
  if cloud_3_x+cloud_3_w<=0-R(50,100):
    cloud_3_x=R(900,1000)
    cloud_3_y=R(20,60)
    cloud_3_w=R(40,70)
    cloud_3_h=R(20,40)
#enery,score,etc.  
#  PrintData()
  F(gx,gy-2,gw,2,"green")
#AREA to the Left
#wall
  F(gx-195,0,5,190,"cyan")
  F(gx-190,0,1,190,bg)
#////ATTENTION/////////////
#///AREA to the RIGHT DARK AND GROOVY :-|

  if px>=gx+area_x[0]:
    F(gx+2900,0,4000,222,"black")
#////( AREA 2!! )////////
#Line to indicate new Area..
  F(gx+2895,20,5,222,"cyan")
#erase line trail..
  F(gx+2894,20,1,222,bg)
  F(gx+2895+2001,20,1,222,bg)
#////////////////////////
#Player in Lava :-(  
  if px+pw>=gx+lava_x and px<=gx+lava_x+lava_w and py+ph>=gy:
    p_energy-=0.09
    F(px,py,pw,ph,"red")
    F(px,py-8,round(p_energy/2),4,"red")
    F(px+round(p_energy/2),py-8,2,4,bg)
    F(px-2,py-8,2,4,bg)
#////////////////////////
#move left/right
  if keydown(KEY_RIGHT):
    px+=2
    F(px-2,py,2,ph,bg)

#CONTAIN PLAYER
#map moves
  if keydown(KEY_LEFT):
    px-=2
    F(px+pw,py,2,ph,bg)

  if keydown(KEY_LEFT) and px<80:
    gx+=2
    px=80
    F(px,py,2,ph,bg)
    
  if keydown(KEY_RIGHT) and px+pw>=190:
    gx-=2
    px=190-pw
#//////////////////////////
#SHOW Player  
  F(px,py,pw,ph,pc)
  F(px+4,py+5,3,6,"black")
  F(px+9,py+5,3,6,"black")
#///////////////////////////
# PLAYER SHADOW..
  if py+ph>=gy-ph:
    F(px,gy-2,pw,2,"black")
#PLAYER outline
  F(px,py,2,ph,"black")
  F(px+pw-2,py,2,ph,"black")
  F(px,py,pw,2,"black")
  F(px,py+ph-2,pw,2,"black")
#///////////////////////
#/////GROUND////////////
  F(gx,gy,gw,gh,gc)
#///////////////////////  
#rect  
  F(gx+rectx,gy-recty,rectw,recth,rectc)
#rect outline
  F(gx+rectx,gy-recty,3,recth,"black")
  F(gx+rectx+rectw-3,gy-recty,3,recth,"black")
  F(gx+rectx,gy-recty,rectw,3,"black")
  F(gx+rectx,gy-recty+recth-3,rectw,3,"black")

  F(gx+lava_x,lava_y,lava_w,lava_h,lava_c)


#rect erase trail  
  F(gx+rectx-2,gy-recty,2,recth,bg)
  F(gx+rectx+rectw,gy-recty,2,recth,bg)
#rect 2 
  F(gx+rect_2_x,gy-rect_2_y,rect_2_w,rect_2_h,rect_2_c)
#rect 2 outline
  F(gx+rect_2_x,gy-rect_2_y,3,rect_2_h,"black")
  F(gx+rect_2_x+rect_2_w-3,gy-rect_2_y,3,rect_2_h,"black")
  F(gx+rect_2_x,gy-rect_2_y,rect_2_w,3,"black")
  F(gx+rect_2_x,gy-rect_2_y+rect_2_h-3,rect_2_w,3,"black")
#rect 2, erase trail  
  F(gx+rect_2_x-2,gy-rect_2_y,2,rect_2_h,bg)
  F(gx+rect_2_x+rect_2_w,gy-rect_2_y,2,rect_2_h,bg)
#rect 3 
  F(gx+rect_3_x,gy-rect_3_y,rect_3_w,rect_3_h,rect_3_c)
#rect 3 erase trail
  F(gx+rect_3_x-2,gy-rect_3_y,2,rect_3_h,bg)
  F(gx+rect_3_x+rect_3_w,gy-rect_3_y,2,rect_3_h,bg)
#rect 3 outline
  F(gx+rect_3_x,gy-rect_3_y,3,rect_3_h,"black")
  F(gx+rect_3_x+rect_3_w-3,gy-rect_3_y,3,rect_3_h,"black")
  F(gx+rect_3_x,gy-rect_3_y,rect_3_w,3,"black")
  F(gx+rect_3_x,gy-rect_3_y+rect_3_h-3,rect_3_w,3,"black")
#rect 4
  F(gx+rect_4_x,gy-rect_4_y,rect_4_w,rect_4_h,rect_4_c)
#rect 4, erase trail  
  F(gx+rect_4_x-2,gy-rect_4_y,2,rect_4_h,bg)
  F(gx+rect_4_x+rect_4_w,gy-rect_4_y,2,rect_4_h,bg)
#rect 4 outline
  F(gx+rect_4_x,gy-rect_4_y,3,rect_4_h,"black")
  F(gx+rect_4_x+rect_4_w-3,gy-rect_4_y,3,rect_4_h,"black")
  F(gx+rect_4_x,gy-rect_4_y,rect_4_w,3,"black")
  F(gx+rect_4_x,gy-rect_4_y+rect_4_h-3,rect_4_w,3,"black")

#//// PLAYER "JUMP"  ///////
  if keydown(KEY_BACKSPACE) and jump_height<=7 and p_on_platform:
    jump=True
    p_score+=R(1,3)
  if jump:
    js=3
    js-=1
    p_on_platform=False
    gravity=False
    py-=js
    
    
    F(px,py+ph,pw,3,bg)
    jump_height+=0.3
  if jump_height>=22:
    jump_height=0
    jump=False
  
  if jump==False:
    gravity=True
#////////////////////////////////////////////
  if gravity:
    gt=3
    gt-=1
    py+=gt
    F(px,py-2,pw,2,bg)
  
  if py+ph>gy:
    py=gy-ph
    p_on_platform=True
    
  if px+pw>=gx+rectx and px<=gx+rectx+rectw and py+ph>=gy-recty and py+ph<=gy-recty+1:
    p_on_platform=True
    py=gy-recty-ph-1

  if px+pw>=gx+rect_2_x and px<=gx+rect_2_x+rect_2_w and py+ph>=gy-rect_2_y and py+ph<=gy-rect_2_y+1:
    p_on_platform=True
    py=gy-rect_2_y-ph-1
    
  if px+pw>=gx+rect_3_x and px<=gx+rect_3_x+rect_3_w and py+ph>=gy-rect_3_y and py+ph<=gy-rect_3_y+1:
    p_on_platform=True
    py=gy-rect_3_y-ph-1
  
  if px+pw>=gx+rect_4_x and px<=gx+rect_4_x+rect_4_w and py+ph>=gy-rect_4_y and py+ph<=gy-rect_4_y+1:
    p_on_platform=True
    py=gy-rect_4_y-ph-1
    rect_4_x+=2
    gx-=2
    F(px-1,py,1,ph,bg)
#///// PLAYER IS ABOVE  //////    
#erase rects     
  else:
    gy-=1
  if gy<210:
    gy=210
    
  if px<=gx-98:
    px=gx-98
    F(px,py,1,ph,"cyan")
  else:
    F(gx-97,py,2,ph,bg)
#player bends down or 
  if keydown(KEY_DOWN):# and p_on_platform:
    F(px,py-14,pw,14,bg)
    ph=14
    py+=1
  else:
    ph=24
#///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("          ",110,0,bg,bg)
    draw_string("                         ",30,20,bg,bg)
#"pipe"  
  F(gx+lava_x+100,gy-160,300,2,"black")
#erase trail  
  F(gx+lava_x+98,gy-160,2,2,bg)
  F(gx+lava_x+400,gy-160,2,2,bg)
  
  
#BULLET GOES LEFT FAST!
  bullet_x-=3
#SHOW BULLET
  F(bullet_x,bullet_y,bullet_w,bullet_h,bullet_c)
  F(bullet_x+5,bullet_y+5,8,4,"red")
  F(bullet_x+bullet_w,bullet_y,3,bullet_h,bg)
#BULLET OUTLINE
  F(bullet_x,bullet_y,1,bullet_h,"blue")
  F(bullet_x+bullet_w-1,bullet_y,1,bullet_h,"blue")
  F(bullet_x,bullet_y,bullet_w,1,"blue")
  F(bullet_x,bullet_y+bullet_h-1,bullet_w,1,"blue")
  
#RANDOMIIZE BULLET..  
  if bullet_x+bullet_w<0-R(20,50):
    bullet_x=R(500,700)
    bullet_y=R(20,170)
    
  if px+pw>=bullet_x and px<=bullet_x+bullet_w and py+ph>=bullet_y and py<=bullet_y+bullet_h:
    F(px,py,pw,ph,"red")
    F(px+pw,py,3,ph,bg)
    p_energy-=0.2
    px-=2
  
#player on bullet
  if px+pw>=bullet_x and px<=bullet_x+bullet_w and py+ph>=bullet_y and py<=bullet_y+1:
    py=bullet_y-ph
    p_on_platform=True
    
#******************************************************  
  if keydown(KEY_LEFT) and px<154:
    px=154
    gx+=2
#******************************************************  
  if keydown(KEY_RIGHT) and px+pw>=168:
    px=168-pw
    gx-=2
    
    
  if keydown(KEY_UP):
    py-=6


#player teleports to aa new game!
  if px>=gx+area_x[2]:
    from ninja import *

  F(gx+lava_x-12,lava_y-15,12,40,"black")
  F(gx+lava_x+1,lava_y-15,2,40,bg)
  F(gx+lava_x-14,lava_y-15,2,40,bg)
#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,"blue")
#****************************    
  F(gx+area_x[0]-3,0,3,gy,bg)
  F(gx+area_x[0],0,3,gy,"blue")
  F(gx+area_x[0]+1,0,3,gy,"blue")

#player teleports!
  if py<-1500:
    from egor_2 import *


#//////[REMINDER]/////

  T-=0.015
  
  
  if T<0:
    game=False
    REMIND=True
    while not keydown(KEY_EXE):
      draw_string(str(note),45,80)
      draw_string("Press [EXE] to resume game",10,200) 

  if keydown(KEY_OK) and REMIND:
    fill_rect(0,0,322,222,(200,255,255))
    while not keydown(KEY_EXE):
      draw_string("Hey, don't forget to:",30,20)
      F(0,50,322,2,"black")
      draw_string(str(note),45,70)
      F(0,160,322,2,"black")
      
      draw_string("Press [EXE] to resume game",10,200) 
    F(0,0,322,222,bg)
#    REMIND=False
  draw_string(chr(25)+":"+str(round(T)),2,2,(0,0,120),bg)

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.