commit:a94142c8907f0e91c1d628d4b7a5310a338617a6
author:Chip Black
committer:Chip Black
date:Sun Jul 13 01:30:15 2008 -0500
parents:cfa42a5f0589706c89c2267917c9a354c00ebb4b
Fixed bitrotten bouncetest.py and surfacetest.py, deleted scrolltest.py

scrolltest.py no longer worked with the current engine setup
diff --git a/bouncetest.py b/bouncetest.py
line changes: +9/-3
index 7106118..7bbbff1
--- a/bouncetest.py
+++ b/bouncetest.py
@@ -28,9 +28,9 @@ else:
 class Bouncer:
 	def __init__(self):
 		self.velocity = [random.uniform(-10,10),random.uniform(-10,10)]
-		self.sprite = Sprite(spritefile,False)
+		self.sprite = Sprite(spritefile)
 		self.sprite.framerate = 9.0
-		self.sprite.anim_start()
+		self.sprite.play()
 		#self.sprite.color = (random.random(),random.random(),random.random(), 0.5)
 		self.sprite.position = [random.randrange(0,resolution[0]),random.randrange(0,resolution[1])]
 		self.sprite.gen_displaylist()
@@ -68,10 +68,14 @@ def update():
 	for b in bouncers:
 		b.update()
 
+Engine.updaters.append(update)
+
 def draw():
 	for b in bouncers:
 		b.draw()
 
+Engine.drawers.append(draw)
+
 n = 0
 def fpsthing():
 	global n
@@ -82,4 +86,6 @@ def fpsthing():
 		print fps
 		n = 0
 
-Engine.engine([],[update,fpsthing],[draw])
+Engine.updaters.append(fpsthing)
+
+Engine.run()

diff --git a/scrolltest.py b/scrolltest.py
line changes: +0/-62
index d67591e..0000000
--- a/scrolltest.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-
-import pygame
-from Sprite import *
-from Collage import *
-import Engine
-
-#resolution = (1280,1024)
-resolution = (640,480)
-#resolution = (320,240)
-
-Engine.init(resolution)
-
-pygame.display.set_caption("scrolltest")
-
-ground = Collage('data/example1')
-ground.position = [0,0]
-stars = Collage('data/stars')
-stars.position = [0,0]
-candelabra = Sprite(['Sprites/candelabra_short/cand_s_1.png','Sprites/candelabra_short/cand_s_2.png','Sprites/candelabra_short/cand_s_3.png','Sprites/candelabra_short/cand_s_4.png'])
-candelabra.position = [64, 64]
-candelabra.setScale(4.0)
-candelabra.setGravity(CENTER, BOTTOM)
-candelabra.setFramerate(10.0)
-candelabra.play()
-
-#pygame.mixer.music.load('horizon.ogg')
-#pygame.mixer.music.play()
-
-def update():
-	ground.position[0] -= 5
-	if ground.position[0] < 0:
-		ground.position[0] += 640
-	stars.position[0] -= 1
-	if stars.position[0] < 0:
-		stars.position[0] += 640
-	candelabra.position[0] -= 5
-	if candelabra.position[0] < 0:
-		candelabra.position[0] += 640
-
-def draw():
-	stars.draw()
-	stars.position[0] -= 640
-	stars.draw()
-	stars.position[0] += 640
-	ground.draw()
-	ground.position[0] -= 640
-	ground.draw()
-	ground.position[0] += 640
-	candelabra.draw()
-
-n = 0
-def fpsthing():
-	global n
-	n += 1
-	if n == 100:
-		fps = "%0.1f FPS" % Engine.fpsman.get_fps()
-		pygame.display.set_caption("bouncetest [%s]" % fps)
-		print fps
-		n = 0
-
-Engine.engine([],[update,fpsthing],[draw])

diff --git a/surfacetest.py b/surfacetest.py
line changes: +6/-3
index 6cc64f3..1593417
--- a/surfacetest.py
+++ b/surfacetest.py
@@ -56,11 +56,13 @@ def input(e):
 		elif e.key == pygame.K_UP or e.key == pygame.K_DOWN:
 			gamestate.direction[1] = 0
 
+Engine.eventhandlers.append(input)
+
 
 def update():
 	player.position[0] += gamestate.direction[0]
 	player.position[1] += gamestate.direction[1]
-	if surfaces.collide(player.position):
+	if surfaces.collidePoint(player.position):
 		if not gamestate.colliding:
 			player.setColor(1.0,0.2,0.2)
 			gamestate.colliding = True
@@ -69,11 +71,12 @@ def update():
 			player.setColor(1.0,1.0,1.0)
 			gamestate.colliding = False
 		
-
+Engine.updaters.append(update)
 
 def draw():
 	surfaces.draw()
 	player.draw()
 
+Engine.drawers.append(draw)
 
-Engine.engine([input],[update],[draw])
+Engine.run()