Em.
As in marisa's SC's, the player, bullets, background all shake in the same direction.
another variable can be used to determine the shaking x=rand(-10,10), y=rand(-10,10);
Then I made this to demonstrate shaking of player and bullets:
#TouhouDanmakufu
#Title[Shaking "Vision error"]
#Text[...]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let ImgBoss = "script\img\ExRumia.png";
let frame = -120;
let MAX=30;
let i;
let j;
let x;
let y;
let xtemp=0;
let ytemp=0;
let playerX;
let playerY;
let shaking=0;
@Initialize{
SetLife(4000);
SetTimer(60);
SetScore(1000000);
SetMovePosition02(GetCenterX, GetClipMinY+120, 120);
CutIn(YOUMU, "Shaking "\""Vision error"\", "", 0, 0, 0, 0);
LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
LoadUserShotData(GetCurrentScriptDirectory~"images\shot_All.txt");
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame%80==20&&frame>0){
ascent(i in 0..MAX){
ascent(j in 0..8){
Bullet(2, GetAngleToPlayer+i*360/MAX, j*8);
}
}
}
if(frame%240==40){
shaking=1;
}
if(frame%240==140){
shaking=0;
}
if(frame%240>=40&&frame%240<140){
playerX=GetPlayerX-xtemp;
playerY=GetPlayerY-ytemp;
}
if(shaking==1){
xtemp=rand(-10,10);
ytemp=rand(-10,10);
SetPlayerX(playerX+xtemp);
SetPlayerY(playerY+ytemp);
}
frame++;
yield;
}
@DrawLoop{
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(ImgBoss);
}
task Bullet(v, angle, delay){
loop(delay){yield;}
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
Obj_SetSpeed(obj,0);
Obj_SetAngle(obj,angle);
ObjShot_SetGraphic(obj, 57);
ObjShot_SetDelay(obj, 10);
let objX=Obj_GetX(obj);
let objY=Obj_GetY(obj);
while(Obj_BeDeleted(obj)==false){
if(shaking==0){
Obj_SetPosition(obj, objX, objY);
}else{
Obj_SetPosition(obj, objX+xtemp, objY+ytemp);
}
objX+=cos(angle)*v;
objY+=sin(angle)*v;
yield;
}
}
}
The bullets does not shake in the way as same as the player. Why?