飛行機射撃ゲーム(Javaベース)
1644 ワード
飛行機射撃ゲーム(Javaベース)
スーパークラスFlingObject
##英雄機類
スーパークラスFlingObject
package pers.zhaxi.shootgame.shoot01;
import java.util.Random;
/*
*
* Hero
* Airplan
* BigAirplan
* SuperAirplan
* , ,
* ,
*/
public class FlingObject {
//
protected int width ; //
protected int height ; //
protected int x ; // x
protected int y ; // y
/*
*
*
* x y
*/
public FlingObject(int width , int height ){
this.width = width ;
this.height = height ;
Random ran = new Random() ;
x = ran.nextInt(480-width) ;
y = -height ;
}
//
public FlingObject(int width , int height, int x ,int y ){
this.width = width ;
this.height = height ;
this.x = x ;
this.y = y ;
}
//
public void moveing(){
System.out.println("");
}
}
##英雄機類
package pers.zhaxi.shootgame.shoot01;
/*
*
*
* private int life ;
* private int speed ;
* private int doubleFire ;
*
* moveing
*
*/
public class Hero extends FlingObject {
//
private int life ; //
private int speed ; //
private int doubleFire ; //
//
public Hero(){
super(97 , 124 , 150 , 650) ; //
life = 3 ;
speed = 2 ;
doubleFire = 2 ;
}
//
public void moveing(){
System.out.println(" !"+"x:"+x+"; y:"+y+";"
+ " width:"+width+"; height:"+height);
}
}