tl;dr: 2 main noob issues I’m trying to figure out, how to use Collision Bitmasks and How to completely terminate a bullet.
Edit: Jeez, realized this was my first post, thought I had posted before, but I guess I had been lurking. Hi! [/edit]
Hello, I’ve been trying to learn Panda and towards that end have been working on small little projects to demonstrate some key points.
In this case, the goal is a little top down spaceship shooter against other ships. I suppose like a variant of the asteroids demo that comes with Panda, but homegrown and tiny bit different.
So far, I have completed the following:
I have two two-poly models I was able to export from Blender 2.5x (no textures) - a ship and a bullet. I’m able to have the player’s ship controlled by wasd controls, and shoots with spacebar. An CPU ship currently is there to just fly in a circle to provide something to run into.
The current stumbling block is how to handle the collision. I’ve been working on figuring this out for about two weeks and just can’t seem to get it, yet. Half the terminology in the manual is as of yet lost on me, and while this was nice, it doesn’t help my issue that I can figure out.
The problem is I have four types of objects, player ship, enemy ship, player bullet, enemy bullet. Player bullets should only interact with enemy ships and vice versa, but any two ships shouldn’t be able to collide. I figured this would be great with a collision bitmask, but I can’t get it to work.
When ever I fire a bullet, it collides with the ship firing it, but not the enemy, though inter-ship collisions work. What am I doing wrong? You can see the code here which calls on this class file, the two ‘models’ are here for the ship and here for the bullet. I know it’s a bit messy, but it’s not huge. I’ll be cleaning things up later, once I get a better feel on how to organize things and comment.
Also, am I putting the collision traversers and handlers in the right spots?
After the bullet ends, I am getting rid of the model, but it seems the collision nodes remain… is there a way to get rid of both at the same time? I haven’t researched this as much, since the collision issue has been taking up the majority of my already limited spare time.
Any other suggestions? It’s still very small, so it’s easy to change right now, plus I’d like to learn good techniques before I get too used to bad techniques.
At this point, I’ll take any thoughts I can get. I’ll continue to peruse the forums and manual in the meantime.