Collision, IA

I have two problems to create my game.

something of code:

  1. I can to cause that a missile appears below the ship, what is their position, but I cannot cause that this it has movement (interval).
  1. Like doing so that when it happens a collision between two objects are sent to call a function.

nor idea

  1. like doing so that another object (ship) follows another one. When a ship this controlling itself with the keyboard.

:cry:

my all code ishttp://www.geocities.com/trukof2003/my_code.txt

thaks

sorry could you rephrase? I could not understand your problem.

I’ll respond in Spanish then in English as it appears that you’re having a little trouble communicating- I hope this doesn’t offend anyone.

Espaùol
Tampoco entiendo bien lo que quieres- al ver tu code pude encontrar unas cosas que tal vez te esten molestando. En primer lugar tu llamas al Pusher en el sistema de Collision- el Pusher solo hace que dos esferos no ocupen el mismo lugar al mismo tiempo- no hace nada mas que eso a menos que tu des instrucciones para un “evento” ya que el Pusher es ambos la cosa para impedir cosas ocupando el mismo lugar y tambien es un “CollisionHandlerEvent” - pero tu tienes que proveer la manera que quieres que el sistema te de el informe de choques. Vease www.panda3d.org/manual/index.php/Collision_Handlers.

La otra cosa que veo es que estas utilizando los intervals para movimiento. Para mi, nunca han funccionado bien. Mejor es usar un Task para adelantar el modelo de acuerdo con la formula x = v*dt. Asi que puedes calcular el “dt” como el tiempo entre los frames - (cada dibujo) y proveer una velocidad.

Tambien te va a ayudar si usas mas clases para los ojectos. Por ejemplo puedes usar una clase para los missles y cada vez que lo necesites solo llama otro instancia de la clase. Yo tengo un programa que parece similar a lo que estas haciendo, puedes verlo en mi pagina: p3dp.com/?mavasher . Ahi puedes ver mi code para hacer muchas de las cosas que estas intentando.

English
I also don’t understand what you want, but after looking at your code I found a couple of things that may be bugging you. First, you call the Pusher collision system- Pusher only makes it so two spheres don’t occupy the same place at the same time. It doesn’t do anything else unless you give instructions for it to call an “event” because Pusher is both the handler for preventing things from being in the same place and it is a CollisionHandlerEvent handler as well- but you have to provide the way in which you want it to report out the collisions. See www.panda3d.org/manual/index.php/Collision_Handlers

The other thing that I see is that you’re using intervals for movement. I’ve never been able to get this to work well. I think it’s better to use a Task where you advance the model according to the formula: X = dt*v - this way you can calculate “dt” as the time between frames and you just provide a velocity.

It’s also going to help you if you use classes for the objects. For example you can put the missle into a class and everytime you need it, just call another instance of the class. I have a program that looks similar to what you’re doing here. You can see it in my page: p3dp.com/?mavasher . There you can see my code for many of the things you’re trying to do.