Hi
I think that I missed something. I wrote cameraShake function but it's not what I expected. There is code for it and it should go to base.inc
function cameraShake(strX, strY, speed, length, resX, resY)
{
var shakeX, shakeY, shakeDirection;
for(var i=0; i<length; i=i+1)
{
Scene.SkipTo(resX/2, resY/2);
shakeDirection = Random(0,3);
if (shakeDirection == 0)
{
//left up corner
shakeX = Random(0,strX);
shakeY = Random(0,strY);
}
if (shakeDirection == 1)
{
//right up corner
shakeX = Random(0,strX) + resX;
shakeY = Random(0,strY);
}
if (shakeDirection == 2)
{
//left down corner
shakeX = Random(0,strX);
shakeY = Random(0,strY) + resY;
}
if (shakeDirection == 3)
{
//right down corner
shakeX = Random(0,strX) + resX;
shakeY = Random(0,strY) + resY;
}
Scene.SkipTo(shakeX, shakeY);
Sleep(speed);
Scene.SkipTo(resX/2, resY/2);
Sleep(speed);
}
}
strX, strY is a strenght of shake
speed its speed between shakes in milisec
resX, resY is resolution of your game
lenght is just a lenght of shake
Thanks to putting this function to base.inc you have access to this from every script just calling cameraShake(100,100,100,10,1280,720); - this parameters works for me.
If somebody has any idea how to improve this function please help
Maybe together we will do it properly.