Yay, a post that’s not a status report!

In response to this thread:
http://blenderartists.org/forum/showthread.php?t=190856

I started poking around at the BGE and in particular focusing on “replacing” the built-in KX_GameObject with a user defined subclass. Mostly, all I currently have is that the user defined class’ main() method get’s called every frame. This allows users to simply create a class for an object and not even need to touch logic bricks. A video showing this can be found here:

http://www.youtube.com/watch?v=rJZItbSW1kg

And a Windows build with the patch can be found here:

http://www.graphicall.org/builds/builds/showbuild.php?action=show&id=1468

Since posting the video and build, I’ve done a bit more playing around, and I have collision callbacks working now too. The class I’m currently doing testing with:

import bge # New top level module in 2.5

class Player(bge.types.KX_GameObject):
	def main(self):
		if (bge.events.SPACEKEY, bge.logic.KX_INPUT_ACTIVE) in bge.logic.keyboard.events:
			self.applyRotation((0, 0, .05), True)

	def on_collision(self, other):
		self.applyForce((0, 0, 500), True)

Cheers,
Moguri

Advertisements