As my math is horrible at such moments, I have 2 questions on creating pattern/shots
First one is a "crawling" or continuous curving shot, like the ones from SA I think.
[attach=1]
I have this already but apparently I seem to fail (feel free to laugh). The problem is that my shot doesn't even behave like this and doesn't even aim at the player initially.
task fireAfroCrawlShot00(obj) {
let sf = 0;
let dir = 0;
let crawlShot00 = CreateShotA(ObjMove_GetX(obj),ObjMove_GetY(obj),10);
let crawlShot01 = CreateShotA(ObjMove_GetX(obj),ObjMove_GetY(obj),10);
dir = GetAngleToPlayer(obj);
SetShotDataA(crawlShot00,0,3,dir,0,0,3,87);
SetShotDataA(crawlShot01,0,3,dir,0,0,3,87);
while(!Obj_IsDeleted(obj)) {
ObjMove_SetAngle(crawlShot00,dir);
ObjMove_SetAngle(crawlShot01,-dir);
dir = 12*sin(sf);
sf+=8;
yield;
}
}
Second one: How do I produce shapes using the correct math? Like a square, triangle, star. I've been staring at graphs and other gifs on the internet but I simply don't get how to transform the correct code. If someone can show me a simple example I can perhaps try to understand what is going on.