meteor.py

Created by squarepoint

Created on September 25, 2022

4.07 KB

Play with +,3,-,* Move your cube and dodge the meteors, but watch out not to fall in the lava!


#/METEOR/ - A very unoptimised game by squarepoint
from ion import *
from kandinsky import *
from time import sleep
from random import randint
black=color(50,50,50)
orange=color(255,100,50)
white=color(255,255,255)
grey=color(150,150,150)
blue=color(50,180,255)
red=color(255,50,50)
dblue=color(50,50,255)
def menu():
  fill_rect(0,0,320,225,black)
  fill_rect(30,30,260,70,grey)
  fill_rect(110,40,100,40,dblue)
  draw_string("/METEOR/",120,50,orange,dblue)
  draw_string("By squarepoint",150,80,white,grey)
  score=0
  draw_string('Press "+" to play!',80,130,white,black)
  while True:
    if keydown(KEY_PLUS):
      break
  for i in range(16):
    fill_rect(i*20,0,20,110,grey)
    sleep(0.03)
    fill_rect(i*20,110,20,112,grey)
    sleep(0.03)
  score=game(2,score)
  draw_string('<PRESS "+">',100,100,white,black)
  while True:
    if keydown(KEY_PLUS):
      break
  score=game(1,score)
  draw_string('<PRESS "+">',100,100,white,black)
  while True:
    if keydown(KEY_PLUS):
      break
  score=game(0,score)
  fill_rect(10,70,300,90,grey)
  draw_string("YOU LOST",120,80,orange,grey)
  draw_string("YOUR SCORE: "+str(score),70,100,white,grey)
  draw_string('Press "+" to play again!',40,160,white,black)
  if score<=100:
    draw_string("Are you doing a die speedrun?",10,120,white,grey)
  elif score<=500:
    draw_string("Meh, you should train more!",20,120,white,grey)
  elif score<=1000:
    draw_string("Mmyeah, that's an ok score!",20,120,white,grey)
  elif score<=1500:
    draw_string("Preety good man!",80,120,white,grey)
  elif score<=2000:
    draw_string("GG, you're starting to get pro!",10,120,white,grey)
  elif score<=2500:
    draw_string("Congrats, pro!",80,120,white,grey)
  elif score<=3000:
    draw_string("EPIC skill bro!",80,120,white,grey)
  else:
    draw_string("OMG! You're better than God!!",20,120,white,grey)
  while True:
    if keydown(KEY_PLUS):
      break
  
def game(life,score):  
  x=155
  y=100
  g=0
  jump=1
  meteor=[]
  difficulty=25
  while True:
    if score%int(difficulty)==0:
      meteor.append([randint(0,300),25,0])
    meteor2=[]
    for i in range(len(meteor)):
      if meteor[i][1]<=200:
        if get_pixel(meteor[i][0]+10,meteor[i][1]+20)==grey:
          meteor2.append([meteor[i][0],meteor[i][1],1])
        else:
          if meteor[i][2]<200 and meteor[i][2]>0:
            meteor2.append([meteor[i][0],meteor[i][1],meteor[i][2]+1])
          elif meteor[i][2]==0:
            meteor2.append([meteor[i][0]+randint(-2,2),meteor[i][1]+5,0])
    meteor=meteor2
    if keydown(KEY_THREE)and x>0 and get_pixel(x-1,y+5)!=grey:x-=5
    elif keydown(KEY_MINUS)and x<310 and get_pixel(x+11,y+5)!=grey:x+=5
    if keydown(KEY_MULTIPLICATION)and jump==0:
      g=8
      jump=1
    if not get_pixel(x+3,y+11)==grey and not get_pixel(x+7,y+11)==grey:g-=1
    else:
      g=0
      jump=0
      while get_pixel(x+3,y+11)==grey or get_pixel(x+7,y+11)==grey:
        y-=1
        fill_rect(0,170,320,40,grey)
        for i in range(len(meteor)):
          if meteor[i][2]>1:
            fill_rect(meteor[i][0]-10,meteor[i][1]-10,40,40,black)
        fill_rect(x,y,10,10,blue)
    y-=g
    fill_rect(0,170,320,40,grey)
    fill_rect(0,25,320,145,black)
    for i in range(len(meteor)):
      if meteor[i][2]==0:
        fill_rect(meteor[i][0],meteor[i][1],20,20,orange)
        fill_rect(meteor[i][0]+5,meteor[i][1]+5,10,10,color(255,180,100))
        fill_rect(meteor[i][0]+randint(2,6),meteor[i][1]-randint(13,17),12,12,red)
        fill_rect(meteor[i][0]+randint(4,8),meteor[i][1]-randint(28,32),8,8,red)
      elif meteor[i][2]==1:
        fill_rect(meteor[i][0]-10,meteor[i][1]-10,40,40,orange)
      else:
        fill_rect(meteor[i][0]-10,meteor[i][1]-10,40,40,black)
    fill_rect(0,210,320,50,orange)
    fill_rect(x,y,10,10,color(50,180,255))
    if get_pixel(x+5,y-1)==orange or get_pixel(x+5,y+11)==orange:
      return score
    fill_rect(0,0,320,25,grey)
    draw_string("/METEOR/",10,3,orange,dblue)
    draw_string("LIVES: "+str(life)+" SCORE: "+str(score),100,3,white,grey)
    score+=1
    if difficulty>6:
      difficulty-=0.05
    sleep(0.05)
while True:
  menu()
  sleep(0.3)

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.