sprite_tester.py

Created by wperez274

Created on March 28, 2023

2.56 KB

To be used with “sprite_maker.py”

Paste the list created with “spritemaker.py”


from math import *
from random import *
from random import randint as R
from kandinsky import *
from ion import *
from time import *



RED=(255,0,0)
GREEN=(0,255,0)
BLUE=(0,0,255)
YELLOW=(255,255,0)
CYAN=(0,255,255)
GRAY=(160,)*3
BLACK=(0,)*3
WHITE=(255,)*3



cursorx=100
cursory=100
cursorw=10
cursorh=10
cursorc=CYAN


bg=(0,0,0)



scrollx=5
scrolly=4


#default 
sprite=[]





##***********#***********
# paste sprite list below here

  
sprite= [[43, 41, 59, 18, (255, 0, 255)], [65, 58, 18, 70, (255, 0, 255)]]





#*****[ Above here goes sprite list ]**********


  
def draw_sprite():
  global sprite,x,y,scale
  
  for i in sprite:
    fill_rect(*i)
  



fill_rect(0,0,322,222,bg)


if len(sprite)==0:
  draw_string("?..Wheres the sprite ??",30,200,(0,0,0),(200,255,255))






while not keydown(KEY_EXE):


  draw_sprite()
  
  
    
  draw_string(str(sprite),scrollx,scrolly,GREEN,BLACK)




  if keydown(KEY_SHIFT):
    sleep(0.01)
    scrollx-=2

  if keydown(KEY_ALPHA):
    sleep(0.01)
    scrollx+=2
    fill_rect(0,200,322,20,bg)


  if keydown(KEY_LEFT):
    sleep(0.01)

    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)


    fill_rect(0,200,322,20,bg)

    cursorx-=2


  if keydown(KEY_RIGHT):
    sleep(0.01)
    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)

    fill_rect(0,200,322,20,bg)

    cursorx+=2

  if keydown(KEY_UP):
    sleep(0.01)
    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)


    fill_rect(0,200,322,20,bg)

    cursory-=2

  if keydown(KEY_DOWN):
    sleep(0.01)

    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)


    fill_rect(0,200,322,20,bg)

    cursory+=2

  

  if keydown(KEY_LEFTPARENTHESIS):
    sleep(0.01)
    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)
    fill_rect(220,100,122,20,bg)
    
    cursorh-=1


  if keydown(KEY_RIGHTPARENTHESIS):
    sleep(0.01)
    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)
    fill_rect(220,100,122,20,bg)

    cursorh+=1


  if keydown(KEY_MULTIPLICATION):
    sleep(0.01)
    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)
    fill_rect(220,100,122,20,bg)

    cursorw-=1



  if keydown(KEY_DIVISION):
    sleep(0.01)
    fill_rect(cursorx-2,cursory-2,cursorw+4,cursorh+4,bg)
    fill_rect(220,100,122,20,bg)
    cursorw+=1
    

  if cursorw<3:
    cursorw=3

  if cursorh<3:
    cursorh=3



  draw_string(str(get_pixel(cursorx+int(cursorw/2),cursory+int(cursorh/2))),160,200,GRAY,BLACK)

  draw_string("w:"+str(cursorw)+","+"h:"+str(cursorh),220,100,CYAN,BLACK)



  
  
  fill_rect(cursorx,cursory,cursorw,cursorh,cursorc)

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.