File: hull_weapon_shatter.cpp

package info (click to toggle)
rafkill 1.2.2-3.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 13,268 kB
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (32 lines) | stat: -rw-r--r-- 653 bytes parent folder | download | duplicates (12)
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
#include "spaceobj.h"
#include "bitmap.h"
#include "trigtable.h"
#include "hull_weapon.h"
#include "hull_weapon_shatter.h"

Shatter_WHull::Shatter_WHull( int str ):
HullWeapon( 0, 1, str ){}

void Shatter_WHull::Draw( const Bitmap & who, int x, int y ) {

	who.circleFill( x, y, (int)strength, Bitmap::makeColor(255,20,30) );

}


bool Shatter_WHull::Collide( int mx, int my, SpaceObject * check ) {
	if ( check->HitMe( mx, my ) )
		return true;

	for ( int ang = 0; ang < 360; ang += 65 ) {

		int tx = (int)(mx + Tcos(ang)*strength );
		int ty = (int)(my + Tsine(ang)*strength );
		if ( check->HitMe( tx, ty ) )
			return true;

	}

	return false;

}