Collision/Deleting/Speed help

A few questions based on the code you can download and run here. (I figure it would help to run and see the full code, it’s mostly clean and documented. Some info: run the WorldClass.py file to play. WASD moves, space shoots, numbers 1 2 and 3 switch weapons, ESC quits.)

  1. I’m having issues getting the collision on my enemies to work. Right now it uses a collision queue on each enemy. Each enemy runs a task (EnemyShipClass.py, line 13) that removes the bullet node, sets the enemy kill flag to True which ensures the ship will be removed by the UpdateEnemies method (WorldClass.py, line 111).

I’d like for this to be happening via an event, but anything I’ve tried fails to register any hits. The collision information for the enemy ship is at EnemyShipClass.py line 76.

  1. Along the same lines as above, when it DOES register a hit, is there a cleaner way to remove the enemy and the bullet? Right now it’s a mix of removing nodes and deleting the class instance that was the ship, but that doesn’t get rid of the task associated with checking collisions for the enemy, another reason I was hoping to just use events.

  2. I’ve been using globalClock.getDt() to make all movements for my ships and bullets, thinking that was supposed to moderate their speed over time rather than based on frames, but depending on what computer I use I’m seeing incredibly different results. Am I doing something wrong? (Movement of player ship in PlayerShipClass.py, line 80).

Any help on this would be greatly appreciated! I’m new so these concepts don’t quite come naturally to me.

take a look at this, it might help you, its not perfect, some weird stuff may be inside
pastie.org/2344259
relevant is line 21 and uponDeath arg.

also take a look at this file, it might help you understand how to use events (i use pusher handler, its event handler with some additional stuff)
pastie.org/2344270

Ok, so after a lot of dicking around it turns out I’m not supposed to be creating a new traverser and collision handler for each new object. I guess it came from reading this bit in the manual wrong: “Each object can only have one collision handler associated with it.”

I think I’m going to ignore the pusher and just make my own events that handle things properly. Good to know!

As to the code you provided GrizzLyCRO, thank you. I have some more insight as to how I’ll get rid of things in the game, that’s quite good to know.

Now if I can figure out why the game runs so much differently on the laptop and desktop with respect to speed, I’ll be happy. (for now, of course).