Game Development Community

Screen shake'n effects

by varmint · in Torque Game Engine · 12/08/2003 (10:59 am) · 2 replies


#1
12/08/2003 (10:59 am)
Explosions "shake" the screen, here is an example:
datablock ExplosionData(TrashcanDestroyExplosion2)
{
   soundProfile   = TrashcanDestroyExplosionSound2;
   lifeTimeMS = 500;

   // Volume particles
   particleEmitter = TrashcanDestroyExplosionEmitter;
   particleDensity = 50;
   particleRadius = 0.5;

   // Point emission
   emitter[0] = TrashcanDestroyExplosionSmokeEmitter;
   emitter[1] = TrashcanDestroyExplosionSparkEmitter;

   // Sub explosion objects
   subExplosion[0] = TrashcanDestroySubExplosion1;
   subExplosion[1] = TrashcanDestroySubExplosion2;

   // Camera Shaking
   shakeCamera = true;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 1.2;
   camShakeRadius = 30.0;

   // Dynamic light
   lightStartRadius = 4;
   lightEndRadius = 2;
   lightStartColor = "0.5 0.5 0";
   lightEndColor = "0 0 0";
};
You could create an explosion on-the-fly at the player's current position, e.g.
I've written a tutorial quite some time ago how to create particle emitters or explosions, check it out here: tork.zenkel.com/_tutorials/Coding-Scripting/spells/simple_spell.php
For detailed explosion examples check the crossbow.cs script in the Torque demo e.g. ...
#2
12/08/2003 (11:12 am)
Or you could code something up in C++ for doing a "shakeCamera" when the player is hit. Look in player.cc around line 2552 to see how they do the camera shake on ground impact.