myfunctions.py

Created by wperez274

Created on February 01, 2023

995 Bytes

Some functions I wrote.


from math import *
from turtle import *
from random import *
from kandinsky import *
from ion import *
from time import *


#line across
def line(y,c):
  x=0
  w=322
  h=2
  fill_rect(x,y,w,h,c)

def paint(c):
  fill_rect(0,0,322,120,c)
  fill_rect(0,0,322,3,(0,0,0))
  fill_rect(0,120,322,3,(0,0,0))
  draw_string("(r,g,b) = "+str(c),34,150)

  
def drawBox(x,y,w,h,c):
#left,right,up,down
  fill_rect(x,y,2,h,c)
  fill_rect(x+w-2,y,2,h,c)
  fill_rect(x,y,w,2,c)
  fill_rect(x,y+h-2,w,2,c)

  
def printGameover(x,y,c,bg):
  draw_string("GAME OVER",x,y,c,bg)
  



def R(n1,n2):
  
  num=randint(n1,n2)
  
  return num
  

def rt3():
  
  rgb=(randint(0,255),randint(0,255),randint(0,255))  
  
  return rgb
  
  

  
  



def p(s):
  
  print(s)  
  
  
def launcher():
  import launcher
  
def rgb():
  import rgb



def drawEnergy(e,x,y):
  c="red"
  
  
  
  
  en=round(e/2)
  
  
  
  
  for i in range(x,en*10,12):
    
    fill_rect(i,y,10,10,c)

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.