From d64ea3c18599d3df0065b6466c90bbdf0411bd56 Mon Sep 17 00:00:00 2001 From: slm Date: Thu, 05 Aug 2010 04:56:35 +0000 Subject: Deleted depreciated directories of tests - finalized the prototype of the Drawable Object test to be included in the complete test kit. --- (limited to 'devtools/SpriteTypeTest/spriteTest.py') diff --git a/devtools/SpriteTypeTest/spriteTest.py b/devtools/SpriteTypeTest/spriteTest.py deleted file mode 100755 index 8030578..0000000 --- a/devtools/SpriteTypeTest/spriteTest.py +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/env python -import pygame, time -pygame.init() - -print "\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n" -print "Sprite Test - Authors Dave Silverman and Scott Mengel" -print "Set size to 600 x 400 px" -print "Running..." - - - -#-------------------------------------------------------------- -#CONSTANTS AND VARIABLES - -make=input("How many images would you like to load? ") -trial=input("How many runs per trial? ") -sprite={} -ft="" #filetype -r=0 #frame refreshes -i=1 #cycles images -size = width, height = 600,400 #screen sizes -t=0 #trial number n -colorkey=(255, 152, 0) - -ftArr=[ ["bmp","BMPs 16-Bits/"] , ["bmp","BMPs 24-Bits/"] , ["bmp","BMPs 32-Bits/"] , ["gif","GIFs/"] , ["gif","GIFs Transparent/"] , ["jpg","JPGs 1Low/"] , ["jpg","JPGs 2Medium/"] , ["jpg","JPGs 3High/"] , ["jpg","JPGs 4Max/"] , ["png","PNGs Indexed/"] , ["png","PNGs Transparent/"] ] - -screen = pygame.display.set_mode(size) #Screen Set 600x400 -background = 152, 251, 152 # pale green - - -#------------------------------------------------------------- -#The switch function - -def chngSprite(): - cnt=make - while cnt>0: - switcher = { - 1: pygame.image.load("%s2 Button.%s"%(ft[1],ft[0])), - 2: pygame.image.load("%s3 Button.%s"%(ft[1],ft[0])), - 3: pygame.image.load("%s4 Button.%s"%(ft[1],ft[0])), - 4: pygame.image.load("%s5 Button.%s"%(ft[1],ft[0])), - 5: pygame.image.load("%s6 Button.%s"%(ft[1],ft[0])), - 6: pygame.image.load("%s7 Button.%s"%(ft[1],ft[0])), - 7: pygame.image.load("%s8 Button.%s"%(ft[1],ft[0])), - 8: pygame.image.load("%s9 Button.%s"%(ft[1],ft[0])), - 9: pygame.image.load("%s1 Button.%s"%(ft[1],ft[0])) - } - sprite[cnt,0]=switcher.get(i,pygame.image.load("%s1 Button.%s"%(ft[1],ft[0]))) - sprite[cnt,0] = pygame.transform.scale(sprite[cnt,0],(20, 20)) - cnt=cnt-1 - - -#----------------------------------------------------------------- -#- Collision detection ------------------------------------------- - -def collision(): - cnt=make - while cnt>0: - if sprite[cnt,1].left < 0 or sprite[cnt,1].right > width: - sprite[cnt,2]=[ -sprite[cnt,2][0], sprite[cnt,2][1] ] - if sprite[cnt,1].top < 0 or sprite[cnt,1].bottom > height: - sprite[cnt,2]=[ sprite[cnt,2][0], -sprite[cnt,2][1] ] - sprite[cnt,1] = sprite[cnt,1].move(sprite[cnt,2]) - screen.blit(sprite[cnt,0],sprite[cnt,1]) - cnt=cnt-1 - pygame.display.flip() - - -#----------------------------------------------------------------- -#- Number of dashed lined relates to loops ----------------------- - -while 1: - cnt=make - ft=ftArr[t] - print "Testing "+ft[1]+"N Button."+ft[0] - trialthis=trial - -#----------------------------------------------------------------- - while trialthis>0: - - #------------------------------------------------------------- - while cnt>0: - sprite[cnt,0]= pygame.image.load("%s1 Button.%s"%(ft[1],ft[0])) #image.load - sprite[cnt,0] = pygame.transform.scale(sprite[cnt,0],(20, 20)) - sprite[cnt,1]= sprite[cnt,0].get_rect() - sprite[cnt,2]= [2,2] #speed - m=cnt*40 # named m cause i wanted some m&ms - sprite[cnt,1]=sprite[cnt,1].move(m,m) #see? it wasn't as tastey though - cnt=cnt-1 - - #------------------------------------------------------------- - r=0 - start=time.time() - - #------------------------------------------------------------- - while 1: - chngSprite() - i=i+1 - if i>9: i=1 - - collision() - screen.fill(background) - - r=r+1 - if r>500: break - - #------------------------------------------------------------- - print 1/((time.time()-start)/r) - trial=trial-1 - -#----------------------------------------------------------------- - t=t+1 - -#----------------------------------------------------------------- -#----------------------------------------------------------------- -- cgit v0.9.1