Author Topic: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m [Closed, read last post!]  (Read 186187 times)

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #180 on: July 31, 2013, 04:59:25 AM »
GetAngleToPlayer returns the angle from the boss to the player. It doesn't care about your bullet. Even if it did target the player, it would target the player when setting up the bullet to be fired, not at the 60 frame mark.

1. Sometimes the wrong set of lasers disappears (and I don't know why).
2. There will probably be a problem if the player faces to the right because of angles.
Why can't you just choose the first laser that disappears and then switch it every rotation? You don't need any sort of angle-getting from what you're describing.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #181 on: July 31, 2013, 05:04:34 AM »
GetAngleToPlayer is the angle of the boss to the player, not the bullet.
Now, I don't know how to find the angle from a regular bullet to the player without having to use an object bullet.
Code: [Select]

task Bullet(x, y, v, angle, g, d) {
      let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, g);
      ObjShot_SetDelay  (obj, d);
      ObjShot_SetBombResist (obj, false);

wait(60);
                Obj_SetAngle(obj, atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj)));
}
And then you call the task and fill out the parameters. This might seem confusing at first, but object bullets make the best attacks.
Currently a normal player

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #182 on: July 31, 2013, 05:19:31 AM »
A simpler method would be using SetShotDirectionType. Calling the function before defining the SetShotData and setting the new angle to 0 will automatically redirect the bullet to the player regardless of where it is. Don't forget to set it back to ABSOLUTE afterwards, that is~

Code: [Select]
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,2,0,0,0,1,60);
SetShotDirectionType(PLAYER);
SetShotDataA(1,60,5,0,0,0,0,60);
SetShotDirectionType(ABSOLUTE);
FireShot(1);

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #183 on: July 31, 2013, 06:30:43 AM »
Except GetAngleToPlayer and ShotDirection only work if the bullet is actually spawned at it's 0,0 coordinates aka the exact point where it is spawned. If you use it for example at the boss' location with an offset it will simply not 'home in' on the player. Atan2 is more secure in such cases.

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #184 on: July 31, 2013, 07:30:35 AM »
I seem to have a really minor problem.
Code: [Select]
while(!Obj_BeDeleted(objoption) && type=="two"){
Obj_SetAngle(objoption,Obj_GetAngle(objoption) + angle);
Obj_SetPosition(objoption,Obj_GetX(objoption),Obj_GetY(objoption));
ObjEffect_SetAngle(objoption,0,0,spin);
spin+=3;
if(spin>=1675 && Obj_GetSpeed(objoption)<1){ Obj_SetSpeed(objoption,Obj_GetSpeed(objoption) + 0.01); }
if(Obj_GetX(objoption) > GetClipMaxX+10 || Obj_GetX(objoption) < GetClipMinX-10 || Obj_GetY(objoption) > GetClipMaxY+10 || Obj_GetY(objoption) < GetClipMinY-10){
Obj_Delete(objoption);
}
if(Obj_GetSpeed(objoption)>0 && count==0){ Obj_SetSpeed(objoption,Obj_GetSpeed(objoption) - 0.01); }
if(Obj_GetSpeed(objoption)<0.01){
    let dir3 = dir2+45*sin(count*1);
    BulletA(Obj_GetX(objoption),Obj_GetY(objoption),6,dir3,71);
    BulletA(Obj_GetX(objoption),Obj_GetY(objoption),6,dir3+45,71);
    BulletA(Obj_GetX(objoption),Obj_GetY(objoption),6,dir3+90,71);
    BulletA(Obj_GetX(objoption),Obj_GetY(objoption),6,dir3-45,71);
    BulletA(Obj_GetX(objoption),Obj_GetY(objoption),6,dir3-90,71);
    count++;
}
yield;
}
Small enough to be in a post?

Well, the problem is that, after the bullet leaves the battle field and is deleted, two bullets fire from [0,0]
One goes 22.5 degrees, and one goes 67.5 degrees. Approximately.
How do I omit it?
Currently a normal player

Arcorann

  • hey catgirl
  • Surprisingly unkempt
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #185 on: July 31, 2013, 07:52:57 AM »
Well, the problem is that, after the bullet leaves the battle field and is deleted, two bullets fire from [0,0]
One goes 22.5 degrees, and one goes 67.5 degrees. Approximately.
How do I omit it?
You're firing bullets after deleting the object bullet. Putting the if(Obj_GetSpeed(objoption)>0 && count==0) and if(Obj_GetSpeed(objoption)<0.01) blocks inside an else block should fix this.

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #186 on: July 31, 2013, 07:58:42 AM »
Ah, don't mind my problem.
I solved it by putting the statement that deletes the object after the firing bullets statement.
Currently a normal player

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #187 on: July 31, 2013, 08:18:52 AM »
Why can't you just choose the first laser that disappears and then switch it every rotation? You don't need any sort of angle-getting from what you're describing.

Because then the player would be crushed between the large purple laser and the set of lasers on the side of the player if they choose the wrong one.
But if you use angles, this shouldn't happen because the lasers on the side of the player should disappear.
But sometimes the wrong laser disappears, and the player is crushed anyway.
So I would like to know if there is a way to change this or if I should just use what you said and remove the big laser in the middle much earlier.

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #188 on: July 31, 2013, 01:46:33 PM »
Hello everyone. I'm a bit new to this board and English is not my native language so bear with me.

Me and a friend of mine are planning to use this program for our game dev thesis and we're complete newbies to this program so we're going through the tutorials right now. Our current plan is a purely evasion-based game so for starters, we've planned on setting ForbidShot to true and ForbidBomb to true.

We're planning to use our own scoring system and I'm wondering what's the best way to do this. Right now, I'm thinking of using the AddScore function along the lines like the snippet below. The idea is:

  • The closer the player is to the boss, the faster the score counter increments.
  • Timing out the pattern gives a score bonus.
  • Grazing bullets and lasers give bonus as normal.

Code: [Select]
//this will be called each second.
sub updateScore
{
//base score value. Can be anything really.
let baseScore = 500;

//gets the distance between player and boss and uses it as a modifier.
let distance = ((GetEnemyX - GetPlayerX)^2 - (GetEnemyY - GetPlayerY)^2)^0.5;

let addScore = 500*(1/distance);

AddScore(addScore);
}


However i think there's a better way to do this. As for grazing, I think we'll be adding the bonus due to graze by the end of the stage.

Edit: I just realized I botched the formula. fixed it.
« Last Edit: July 31, 2013, 03:10:39 PM by pogisanpolo »

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #189 on: July 31, 2013, 04:24:40 PM »
How to make laser move vertical with laserA?
if Using that is impossible laserA, then how?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #190 on: August 01, 2013, 01:34:17 AM »
How to make laser move vertical with laserA?
if Using that is impossible laserA, then how?

What exactly do you mean by this? You can move the base of the laser, if that's what you mean, but your question is not very clear. Do you want a static layer, a curvy laser, or a laser that has a predefined start and end?

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #191 on: August 01, 2013, 04:58:37 AM »
There are 7 parameter for SetLaserDataA, and the sixth one is to make the base move right and left.
My question is : Is moving the laser's base vertically(up and down)possible with only laserA? possible with only laserA?

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #192 on: August 01, 2013, 11:00:17 AM »
That is not entirely correct; the sixth option is movement speed.
If you enter 0 as the seventh option (movement angle) and a number larger than 0 in the sixth one, the laser will move to the right.
If you want to move the laser somewhere else, just change the angle.

/////////////////////////////////////////

Another question:

Code: [Select]
task Laser(x,y,velocity,angle,length,width,graphic,delay){
let obj = Obj_Create(OBJ_LASER);

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,velocity);
Obj_SetAngle(obj,angle);
ObjLaser_SetLength(obj,length);
ObjLaser_SetWidth(obj,width);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjLaser_SetSource(obj,false);
ObjShot_SetBombResist(obj,true);

wait(199);
loop(30){
CreateShotA(0,ObjLaser_GetEndX(obj),ObjLaser_GetEndY(obj),10);
SetShotDataA_XY(0,0,rand(-1,1),rand(-2,0.5),0,0.01,0,3,237);
FireShot(0);
}
yield;
Obj_Delete(obj);
}

For some reason, when I fire this bullet it won't move; it just stays where it was fired.
How do I solve this?
« Last Edit: August 03, 2013, 10:51:21 AM by KuroArashi100 »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #193 on: August 03, 2013, 05:55:39 PM »
Object Lasers do not move. You can manually change the source point or use Object Sinuate Lasers (curvy lasers)

K+ ~ Bake-Danuki

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #194 on: August 04, 2013, 04:09:53 PM »
Is there a tutorial for animating bosses?

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #195 on: August 04, 2013, 04:16:44 PM »
This is the animation script and it's pretty easy to use.

http://www.shrinemaiden.org/forum/index.php/topic,4711.0.html

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #196 on: August 04, 2013, 09:29:08 PM »
Is there something that gets whether the boss is being damaged at the moment?

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #197 on: August 04, 2013, 11:12:12 PM »
Is there a tutorial for animating bosses?
Animating a sprite is just the selection of image coordinates based on whatever logical clauses you want it to depend on. Commonly, you ask if the boss is moving to the left, to the right, or isn't moving horizontally. For each of those situations you then ask a counter (that counts frames or intervals of frames) what it's currently at, and you fix the appropriate LTRB coordinates.

Or you could structure it differently. The main point is that you're running through some sort of decision tree based on how you want to animate, and select image coordinates accordingly.

Is there something that gets whether the boss is being damaged at the moment?
The most reliable method is just to know what the enemy's life was the previous frame, and compare to what it is now.
What are you going to use this for? In a lot of cases it might be better for your condition to be something else entirely.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #198 on: August 05, 2013, 12:40:50 AM »
The most reliable method is just to know what the enemy's life was the previous frame, and compare to what it is now.
What are you going to use this for? In a lot of cases it might be better for your condition to be something else entirely.
I need it for the damage sound effect for when the boss is almost dead.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #199 on: August 05, 2013, 02:22:14 AM »
Then yeah what I recommended should be enough. Save the boss HP in a variable, after few frames check current HP against it, if less play sound, and reset the variable to the current HP.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #200 on: August 05, 2013, 02:49:06 AM »
Can someone show me how to create shots like the ShootShape function but instead of the bullets moving at their own angle I want the bullets to stay together and move in one angle together.

Like if I wanted to shoot a triangle at the player or something similar to Nue's 12-8 spell card in Double Spoiler.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #201 on: August 05, 2013, 03:29:27 AM »
Just change the angle the bullets shoot at? If you're copying the ShootShape function, it just uses CreateShot01(), and the firing angle of each bullet has nothing to do with keeping the overall pattern intact.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #202 on: August 05, 2013, 04:04:21 AM »
Yes but what I'm trying to do is shoot the entire shape at an angle while keeping its shape. If I want to shoot a triangle shootshape shoots a triangle from the boss in which all sides move away from each other, but I want them to move together.

Arcorann

  • hey catgirl
  • Surprisingly unkempt
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #203 on: August 05, 2013, 04:18:49 AM »
Replace every angle inside a SetAngle or CreateShot** with your input angle, e.g. Obj_SetAngle(obj, angle+i*(360/corners)); --> Obj_SetAngle(obj, angle). Then all the bullets will move in the same direction.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #204 on: August 05, 2013, 04:54:08 AM »
Yes but what I'm trying to do is shoot the entire shape at an angle while keeping its shape. If I want to shoot a triangle shootshape shoots a triangle from the boss in which all sides move away from each other, but I want them to move together.
And I literally just told you how to do that.
Code: [Select]
function ShootShape(spawnX, spawnY, v, angle, num, bside, graphic, delay) {
ascent(i in 0..num) {
let sx = spawnX+cos(angle+i*360/num); let sy = spawnY+sin(angle+i*360/num); let sxN = spawnX+cos(angle+(i+1)*360/num); let syN = spawnY+sin(angle+(i+1)*360/num);
CreateShot01(spawnX, spawnY, v*(((sx-spawnX)^2+(sy-spawnY)^2)^0.5), atan2(sy-spawnY,sx-spawnX), graphic, delay);
ascent(j in 0..bside) {
let toAngle = atan2(syN-sy,sxN-sx); let toDist = (((sxN-sx)^2+(syN-sy)^2)^0.5); let sx2 = sx+toDist/bside*j*cos(toAngle); let sy2 = sy+toDist/bside*j*sin(toAngle);
CreateShot01(spawnX, spawnY, v*(((sx2-spawnX)^2+(sy2-spawnY)^2)^0.5), atan2(sy2-spawnY,sx2-spawnX), graphic, delay);
}
}
}
You're looking at this, right? See the CreateShot01s there? The fourth parameter is the bullet's firing angle, as always. atan2(sy2-spawnY,sx2-spawnX) as an angle just means "fire away from the center". Change it to something else and you're good.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #205 on: August 05, 2013, 02:19:34 PM »
I've tried doing that and all it does is break the shape. Changing either of the CreateShot01's angle makes everything shoot like a normal bullet but all of the bullets are stacked on top of each other.

K+ ~ Bake-Danuki

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #206 on: August 05, 2013, 03:10:35 PM »
Ok.  I may be asking a(nother) noobish question but how to do you make shots launch from the shots current location using AddShot?  When I use it, it just spawns from the boss.

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #207 on: August 05, 2013, 03:59:18 PM »
Enter 0,0 for the coordinates.

Something like:
Code: [Select]
task fire{
loop{
CreateShotA(0,GetEnemyX,GetEnemyY,30);
SetShotDataA(0,0,1,GetAngleToPlayer,0,0,0,RED01);

CreateShotA(1,0,0,0)
SetShotDataA(1,0,1,GetAngleToPlayer+90,0,0,YELLOW01);

AddShot(60,0,1,0);

FireShot(0);
wait(120);
}
}

Will fire a bullet at the player, and after 60 frames a bullet will be spawned from the other bullet's face going 90 degrees to the left of the player.

K+ ~ Bake-Danuki

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #208 on: August 05, 2013, 05:37:28 PM »
Oh.  OK!   :)  Thank you!

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #209 on: August 06, 2013, 07:23:21 AM »
I've tried doing that and all it does is break the shape. Changing either of the CreateShot01's angle makes everything shoot like a normal bullet but all of the bullets are stacked on top of each other.
My bad, I misread how the function was written. I would have implemented it in a different way, so I thought it did what I would have made it do.
The function expands by precalculating each bullet's speed so that it turns out in the right shape. I would have given it an initial size that fits the shape and updates the bullet's positions manually to expand.
This is really really crude because I can't be bothered to change it properly but should pretty much work fine.
Code: [Select]
function ShootShape(spawnX, spawnY, size, v, angle, num, bside, graphic, delay) {
ascent(i in 0..num) {
let sx = spawnX+cos(angle+i*360/num);
let sy = spawnY+sin(angle+i*360/num);
let sxN = spawnX+cos(angle+(i+1)*360/num);
let syN = spawnY+sin(angle+(i+1)*360/num);
let a = atan2(sy-spawnY,sx-spawnX);
CreateShot01(spawnX+cos(angle+i*360/num)*size*(((sx-spawnX)^2+(sy-spawnY)^2)^0.5), spawnY+sin(angle+i*360/num)*size*(((sx-spawnX)^2+(sy-spawnY)^2)^0.5), v, angle, graphic, delay);
ascent(j in 0..bside) {
let toAngle = atan2(syN-sy,sxN-sx);
let toDist = (((sxN-sx)^2+(syN-sy)^2)^0.5);
let sx2 = sx+toDist/bside*j*cos(toAngle);
let sy2 = sy+toDist/bside*j*sin(toAngle);
CreateShot01(spawnX+cos(atan2(sy2-spawnY,sx2-spawnX))*size*(((sx2-spawnX)^2+(sy2-spawnY)^2)^0.5), spawnY+sin(atan2(sy2-spawnY,sx2-spawnX))*size*(((sx2-spawnX)^2+(sy2-spawnY)^2)^0.5), v, angle, graphic, delay);
}
}
}

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -