four little problems in my 2d game .. :P

hey … i’m done with most of the physics for my little game project, but i’m stuck with a few problems now … i’ve also been trying to dodge python scripting through the development process, but the deeper i get, the more probable i am to run into to it … so, i’m diving in! :smiley:

ok, the problems i face now are :

  1. the player is influenced by physics, it is a rigid body … so, it inevitably collides with other objects in the game and its orientation changes … ive managed to constrain it in the 2d plane by using the 2d limiter constraint to the armature of the object. I need to find a way to restrain its its rotation. The object is animated and it does rotate in the animations.

2)I want to animate an explosion when and where the projectile hits any object.

3)how do i make more than one npcs??? i duplicated the npc and moved it to another location. when i hit ‘p’ , the duplicated nps come together to the same location and entangle in physics frenzy … why is this happening??

  1. i want to limit the number of projectiles the player can shoot per unit time. the empty that creates the projectile object is a mouse left key sensor, TRUE level triggering, with a frequency of 40. it works perfectly if you keep the mouse pressed, but if you tap the mouse repeatedly, the frequency is beaten and the thing shoots at a faster rate. how do i beat this??

ive added a screen too …

Attachments


problem (1) solved … i added an orientation constraint … it was justa matter of figuring out the right axes …

2,3 and 4 still open for discussion …

trouble again in problem (1) !! i did manage to align the character along one axis … the character doesnt tilt forward towards the camera and neither does it tilt towards the right or left … but now it rotates towards the right or left after banging into objects … and the trouble is that i cant add another orientation constraint … the first constraint becomes void if i do that …

The problem is that, if i constrain the orientation of the character along one axis, it is still free to rotate about that axis … I dont want my character to rotate at all!

P.S. I solved (2) by using a collision sensor with several edit object actuators each of which adds an individual piece of debris(rigid bodies) where the projectile collided … it looks neat, though it uses up physics … :smiley:

I’ve not tried any of these things (except 2, but that was a while ago), but they might work.

1: If you want your character to be affected by physics but not rotate then you could try making it dynamic but not rigid body.

2: You could use a plane set to halo (I think this keeps it facing the camera). You could then play an explosion animation of it.

3: You could place a single npc on a hidden layer then use Add Object actuator to spawn more at a random location.

4: Introduce a timer that sets a property such as CanShoot to True when it runs down. Make it so a bullet will only fire when the CanShoot property is True then set CanShoot to False and start the timer when a bullet is fired.

Have fun. :slight_smile:

(FunkyWyrm posted while I was typing this out. Some of my suggestions are repeats, but I’ll leave my post as is.)

  1. Make your character Dynamic, not Rigid Body. Dynamic reacts to gravity, but does not rotate in response to collisions like Rigid Body does.

  2. It sounds like you are using a location IPO on your NPCs. If that is the case, then they are just doing what you told them to do (go to a specific global location). Location IPOs are relative to the parent object, and if an object has no parent, then the location is global.

The best solution would probably be to use some other method (like waypoints or patrol areas) to tell them where to go. This tutorial will be very helpful for you:
http://blenderartists.org/forum/showthread.php?t=100512

  1. Use a timer property instead of the frequency setting. When the mouse is clicked, reset the timer to 0. Then use an expression so that the mouse only fires when the timer is greater than the length of time you desire. I’ve attached an example .blend.

Attachments

TimedFire.blend (34 KB)

oi (1) was awesome!!! Such a simple solution … ! It worked … :smiley:

Thanks a lot for the other solutions as well !!! i’m working on it right now …

thanks for the link blendenzo … its a gem …