mapworld.py

Created by wperez274

Created on August 16, 2023

1.35 KB


from math import *
from random import *
from random import randint as RAND
from kandinsky import *
from kandinsky import fill_rect as F
from ion import *
from time import *

BLACK=(0,)*3
WHITE=(255,)*3


bg=WHITE


MAPX=0
MAPY=0
MAPW=5000
MAPH=200


MAPBOX_X1=[MAPX,MAPY,5,MAPH,(0,0,0)]
MAPBOX_X2=[MAPX+MAPW-5,MAPY,5,MAPH,(0,0,0)]
MAPBOX_Y1=[MAPX,MAPY,MAPW,5,(0,0,0)]
MAPBOX_Y2=[MAPX,MAPY+MAPH-5,MAPW,5,(0,0,0)]



r1_x=MAPX+RAND(200,500)
r1_h=RAND(50,120)
r1_y=MAPY+MAPH-r1_h-5
r1_w=RAND(500,1200)
r1_c=(RAND(0,255),RAND(0,255),RAND(0,255))


wall_1=[r1_x,r1_y,r1_w,r1_h,r1_c]




while not keydown(KEY_EXE):
  
  
  MAPBOX_X1=[MAPX,MAPY,5,MAPH,(0,0,0)]
  MAPBOX_X2=[MAPX+MAPW-5,MAPY,5,MAPH,(0,0,0)]
  MAPBOX_Y1=[MAPX,MAPY,MAPW,5,(0,0,0)]
  MAPBOX_Y2=[MAPX,MAPY+MAPH-5,MAPW,5,(0,0,0)]



  fill_rect(*MAPBOX_X1)
  fill_rect(*MAPBOX_X2)
  fill_rect(*MAPBOX_Y1)
  fill_rect(*MAPBOX_Y2)


  



  fill_rect(*wall_1)



  if keydown(KEY_LEFT):
#    fill_rect(0,0,322,222,(255,)*3)
    MAPX+=3
    
    F(wall_1[0]+wall_1[3]+1,wall_1[1],3,wall_1[3],bg)


  if keydown(KEY_RIGHT):
    fill_rect(0,0,322,222,(255,)*3)
    MAPX-=3
    

  if keydown(KEY_UP):
    fill_rect(0,0,322,222,(255,)*3)
    MAPY+=3


  if keydown(KEY_DOWN):
    fill_rect(0,0,322,222,(255,)*3)
    MAPY-=3



  
  wall_1=[MAPX+r1_x,MAPY+r1_y,r1_w,r1_h,r1_c]




#  sleep(0.01)

#  MAPX-=1

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.