Changeset 15
- Timestamp:
- 12/08/07 04:40:37 (1 year ago)
- Files:
-
- trunk/guisterax/guisterax (deleted)
- trunk/guisterax/src/saucer.d (modified) (1 diff)
- trunk/guisterax/src/vect.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/guisterax/src/saucer.d
r10 r15 94 94 Vect f_target = target.pos + 20 * target.speed; 95 95 Vect speed = this.speed + 4 * (f_target - pos).normal(); 96 speed.rotate(rand(-0.2, 0.2)); // we add a random angle to the fire 96 97 m_fire_sound.play(); 97 98 universe.append(new Saucer.Fire(pos, speed), this); trunk/guisterax/src/vect.d
r10 r15 59 59 float norm() {return sqrt(norm2());} 60 60 Vect normal() {assert(norm2() != 0); return *this / norm();} 61 62 // Rotate the vector by angle a (in rad) 63 void rotate(float a) { 64 float c = cos(a); 65 float s = sin(a); 66 x = x * c - y * s; 67 y = x * s + y * c; 68 } 61 69 }; 62 70
