bullet.java

per admin darrera modificació 2020-03-25T16:34:35+02:00
/* Gasteroids v0.1 aplicación didáctica para dispositivos MIDP2.0 Copyright (C) 2006 Victor Carceler This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * Representa un proyectil */ package gpl.gasteroids; /** * La clase Bullet representa un proyectil lanzado por una nave. * * Las propiedades de un Bullet son: *
    *
  • La posición que ocupa (x,y) *
  • La velocidad con la que se desplaza (speed_x, speed_y) *
  • El tiempo de vida (ttl). Al desplazarse ttl se decrementa, cuando se hace 0 el proyectil desaparece *
* * @author Victor Carceler */ public class Bullet { public double x, y; // Posición public double speed_x, speed_y; // Velocidad public int ttl; // Tiempo de vida (en ticks) public String toString() { return "Bullet: Pos(" + x + "," + y + ")"; } }