Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/tanchiki/diff/5cb3fef573f6/game.py
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 10:47:37 2013
Кодировка:
tanchiki: game.py diff

tanchiki

diff game.py @ 54:5cb3fef573f6

UI for two users
author Olga Zolotareva <olya_zol@inbox.ru>
date Sat, 25 Dec 2010 01:51:31 +0300
parents 5450c97fbc38
children
line diff
     1.1 --- a/game.py	Fri Dec 24 23:28:21 2010 +0300
     1.2 +++ b/game.py	Sat Dec 25 01:51:31 2010 +0300
     1.3 @@ -23,15 +23,15 @@
     1.4  		self.invoke_ticks()
     1.5  		self.respawn()
     1.6  		self.update_velocities()
     1.7 -		for i in self.bodies :
     1.8 -			print i
     1.9 -		#	print 'next position' , i.next_position 
    1.10 -			print 'update_position' ,  i.position
    1.11 -			print 'velocity'  , i.velocity
    1.12 -			print 'velocity.rho', i.velocity.rho 	# test
    1.13 -			if isinstance(i,body.Tank) == True:
    1.14 -				print 'base_orientation' , i.base_orientation
    1.15 -			print '\n'
    1.16 +	#	for i in self.bodies :
    1.17 +	#		print i							# test
    1.18 +	#		print 'next position' , i.next_position			# test 
    1.19 +	#		print 'update_position' ,  i.position			# test
    1.20 +	#		print 'velocity'  , i.velocity				# test
    1.21 +	#		print 'velocity.rho', i.velocity.rho 			# test
    1.22 +	#		if isinstance(i,body.Tank) == True:     		# test
    1.23 +	#			print 'base_orientation' , i.base_orientation   # test
    1.24 +	#		print '\n'
    1.25  
    1.26  	def update_velocities(self):
    1.27  		for i in self.bodies:
    1.28 @@ -55,7 +55,6 @@
    1.29  	def collides(self,body1,body2):
    1.30  		if (abs(body1.next_position - body2.next_position) <= (body1.radius + body2.radius)):
    1.31  			if (body1 != body2):
    1.32 -				print 'collision' 
    1.33  				return True
    1.34  			else :
    1.35  				return False
    1.36 @@ -67,12 +66,14 @@
    1.37  			if isinstance(body2, body.Tank) == True :
    1.38  				body1.on_collision(body2)
    1.39  			else :
    1.40 -				body1.on_hit()
    1.41 +				body1.on_hit(body2)
    1.42  				body1.on_death()
    1.43 +				self.bodies.remove(body2)
    1.44  		else :
    1.45  			if isinstance(body2, body.Tank) == True :
    1.46 -				body2.on_hit()
    1.47 +				body2.on_hit(body2)
    1.48  				body2.on_death()
    1.49 +				self.bodies.remove(body1)
    1.50  
    1.51  	def check_walls(self):
    1.52  		for i in self.bodies :
    1.53 @@ -93,13 +94,10 @@
    1.54  		for i in self.users :
    1.55  			if i.tank.strength == 0 :
    1.56  				i.tank.on_spawn()
    1.57 -				print 'respawn'
    1.58 -				print i.tank.strength , i.tank.position
    1.59  				i.tank.strength = 1
    1.60  				i.tank.velocity = vector.null
    1.61  				i.tank.position.x = random.randint(i.tank.radius , width - i.tank.radius)
    1.62  				i.tank.position.y = random.randint(i.tank.radius , height - i.tank.radius)
    1.63  				i.tank.velocity = vector.null 
    1.64 -                                print i.tank.strength , i.tank.position
    1.65  
    1.66   
    1.67 \ No newline at end of file