1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#include "defs.h"
#include "weapon_bounce.h"
#include "weaponobj.h"
#include "hull.h"
Bounce::Bounce( int qx, int qy, double kx, double ky, HullObject * hnew, int al ):
WeaponNode(qx,qy,kx,ky,hnew, al){}
bool Bounce::Damage( double much ) {
hull->takeDamage( 1 );
bool ch[ 2 ];
if ( Util::rnd(2) ) ch[0] = true;else ch[0]=false;
if ( Util::rnd(2) ) ch[1] = true;else ch[1]=false;
if ( !ch[0] && !ch[1] )
switch( Util::rnd(2) ) {
case 0 : ch[0] = true;break;
case 1 : ch[1] = true;break;
}
/* TODO:
* Cleanup
*/
/*
if ( ch[0] ) dx *= -1;
if ( ch[1] ) dy *= -1;
*/
return getLife();
}
/*
void Bounce::MoveReal() {
/ *
virtualx += dx;
virtualy += dy;
actualx = (int)virtualx;
actualy = (int)virtualy;
* /
SpaceObject::MoveReal();
/ * TODO:
* Cleanup this code
* /
/ *
bool change = false;
if ( actualx < 0 ) {
virtualx = 0;
dx *= -1;
change = true;
}
if ( actualx > 640 ) {
virtualx = 640;
dx *= -1;
change = true;
}
if ( actualy < 0 ) {
virtualy = 0;
dy *= -1;
change = true;
}
if ( actualy > 480 ) {
virtualy = 480;
dy *= -1;
change = true;
}
if ( change ) {
double ox = dx;
double oy = dy;
if ( !Damage(0) ) {
actualx = -100;
actualy = -100;
}
else {
dx = ox;
dy = oy;
}
}
* /
}
*/
|