Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 206520 times)

Re: Danmakufu Q&A/Problem thread number 4
« Reply #360 on: September 15, 2010, 02:47:25 AM »
384x448 pixels.

(224, 240) is the center point of the field.
(32, 16) is the top left.
(416, 16) is the top right.
(32, 464) is the bottom left.
(416, 464) is the bottom right.

All these values can be substituted with...
(GetCenterX, GetCenterY) as the center point.
(GetClipMinX, GetClipMinY) as the top left.
(GetClipMaxX, GetClipMinY) as the top right.
(GetClipMinX, GetClipMaxY) as the bottom left.
(GetClipMaxX, GetClipMinY) as the bottom right.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #361 on: September 15, 2010, 04:27:57 AM »
Whoa, thanks!

Hyouga Kazu

  • Legend Seekers, 0th Division Leader
Re: Danmakufu Q&A/Problem thread number 4
« Reply #362 on: September 15, 2010, 06:02:16 AM »
So...  :ohdear:
I guess I could use some help with this: http://pastebin.com/KwKjgNdN

I'm trying to make a player spell with lasers rotating around the player.
Danmakufu didn't really like what I did to those vertices though. This is the closest I got to making them rotate...

Can someone please tell me how to make it work?


Nevermind, I had to leave out those foolish (co)sine functions.  :V
« Last Edit: September 15, 2010, 06:07:33 AM by Karanum »

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #363 on: September 15, 2010, 07:46:50 AM »
Can anyone tell me how to make player bullets that are homing (My attempts result in making bullets that fly around like crazy during stages and breaks everything)
looking for something similar to Mof's Reimu A or CtC's Marisa A.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #364 on: September 15, 2010, 08:47:46 AM »
This is the code I use for the homing bullets of my Suika player. They will home in on the enemy closest to them:

Code: [Select]
     task Homing(x, y, v, angle, avmax, damage, penetration){

    let tenemy=-1;
    let tenemydist=1000;
    let enemydist;
    let tangle;
    let diff;
    let n;

    let obj=Obj_Create(OBJ_SHOT);

    Obj_SetPosition(obj,x,y);
    ObjShot_SetGraphic(obj,11);
    ObjShot_SetDamage(obj,damage);
    ObjShot_SetPenetration(obj,penetration); //
    Obj_SetAngle(obj,angle);
    Obj_SetSpeed(obj,v);
    Obj_SetAlpha(obj,150);

    while(Obj_BeDeleted(obj)==false){

        angle=Obj_GetAngle(obj);
//        avmax=avmax*0.98;

        tenemydist=10000;

        ascent(i in EnumEnemyBegin..EnumEnemyEnd) { // detects the closest valid target

            n=EnumEnemyGetID(i);
            enemydist=( (Obj_GetX(obj) - GetEnemyInfo(n, ENEMY_X))^2 + (Obj_GetY(obj) - GetEnemyInfo(n, ENEMY_Y))^2 )^0.5;
            if(enemydist<tenemydist){

                tenemy=n; tenemydist=enemydist;
            }
        }
        if(tenemydist==10000){ tenemy=-1; }

        if(tenemy!=-1){

            tangle=atan2( (GetEnemyInfo(tenemy, ENEMY_Y) - Obj_GetY(obj)), (GetEnemyInfo(tenemy, ENEMY_X) - Obj_GetX(obj)));

            diff=tangle-angle;


            while(diff>180){ diff-=360; } while(diff<-180){ diff+=360; }

            if( (|diff|)<avmax){ angle=tangle; }

            else{ angle+=avmax*(diff)/(|diff|); }

            Obj_SetAngle(obj,angle);

        }

        yield;
    }
     }

The line that is commented out of the code is there for making the bullets behave more like the bullets in SA's ReimuB by reducing the amount by which the bullet is homing during each frame, but I don'T think you will need this.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #365 on: September 17, 2010, 02:29:28 PM »
On the right are bullets copypasted from a shotsheet image. On the left is the way the bullets are drawn.
The bullets are shot at 90 degrees, and the copied bullets are rotated 90 degrees clockwise as well.
Shotsheet is 512x512, bullets are 15x15 and are drawn on a rounded position.



This does not please me.

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #366 on: September 17, 2010, 04:58:51 PM »
This does not please me.
When did Danmakufu pleased us? This is probably one of the reasons why I keep fucking around (even still) with the shot sheet.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #367 on: September 17, 2010, 05:05:18 PM »
On the right are bullets copypasted from a shotsheet image. On the left is the way the bullets are drawn.
The bullets are shot at 90 degrees, and the copied bullets are rotated 90 degrees clockwise as well.
Shotsheet is 512x512, bullets are 15x15 and are drawn on a rounded position.



This does not please me.
Are the right bullets larger, or is that just my imagination?

Otherwise, I think Mokou had already noticed that there was a difference in look between Alpha effect objects and the Draw function. The same difference seems to exist between Alpha bullets and the draw function.  :derp:
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #368 on: September 17, 2010, 05:12:51 PM »
For the first two, your graphic rect is just off (add 1 to the right and bottom bounds). For the third one, it seems like your sheet's width and height aren't a power of 2, though you said that it is... what blending mode (alpha, add) are you using?

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #369 on: September 17, 2010, 07:12:49 PM »
1. It is not off, the images are all 15x15 and the rect of the first is 4, 48, 19, 63 (which is correct). If I expand it to 16 (to any direction) or 17 it shows the same. This is not a problem with specific rects; the entire shotsheet is like this aside from a few (02s, 03s, stars, knives).
2. Image is on transparent bg, alpha rendered. The add-blended bullets (not shown) are on black.

Note that when I place the graphics on a colored background, it is still distorted. Moving around where the bullet is shot in half-pixels does not really help.

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #370 on: September 21, 2010, 11:14:53 AM »
Edit for Drake :
Well maybe try to change your Rect like (-1,-1,+1,+1)



It should come from the right and top.
However i've always problems with custom round in danmakufu...
So if it works i would like to know what was wrong.

---

Hem so much pages to read, I hope i'm the first for this kind of question...
This time pictures will not illustrate the problem ... look at this please ^^' (unlisted vid)
http://www.youtube.com/watch?v=MxVQIy31iek

The image is : http://img18.imageshack.us/img18/8307/shinkispcercle1.png
There's another one for the bottom.
Oh and there's no problem about rotation of the two Object i've tried without her.
Code: [Select]
let effect=0;
if(effect!=1){effect=effect+1;}
if(effect==1){
circleid=Obj_Create(OBJ_EFFECT);
Obj_SetX(circleid, GetX);
Obj_SetY(circleid, GetY);
ObjEffect_SetTexture(circleid, imagefile);
ObjEffect_SetAngle(circleid,80,0,0);
ObjEffect_SetRenderState(circleid,ALPHA);
ObjEffect_SetPrimitiveType(circleid,PRIMITIVE_TRIANGLELIST);
ObjEffect_CreateVertex(circleid,3);
ObjEffect_SetVertexXY(circleid,0,-142,-142);
ObjEffect_SetVertexXY(circleid,1,426,-142);
ObjEffect_SetVertexXY(circleid,2,-142,426);
ObjEffect_SetVertexUV(circleid,0,0,0);
ObjEffect_SetVertexUV(circleid,1,594,0);
ObjEffect_SetVertexUV(circleid,2,0,594);
ObjEffect_SetLayer(circleid,1);
circle=circle~[circleid];
circleid=Obj_Create(OBJ_EFFECT);
Obj_SetX(circleid, GetX);
Obj_SetY(circleid, GetY);
ObjEffect_SetTexture(circleid, imagefile2);
ObjEffect_SetAngle(circleid,80,0,0);
ObjEffect_SetRenderState(circleid,ALPHA);
ObjEffect_SetPrimitiveType(circleid,PRIMITIVE_TRIANGLELIST);
        ObjEffect_CreateVertex(circleid,3);
ObjEffect_SetVertexXY(circleid,0,-142,-143);
ObjEffect_SetVertexXY(circleid,1,426,-143);
ObjEffect_SetVertexXY(circleid,2,-142,427);
ObjEffect_SetVertexUV(circleid,0,0,0);
ObjEffect_SetVertexUV(circleid,1,594,0);
ObjEffect_SetVertexUV(circleid,2,0,594);
ObjEffect_SetLayer(circleid,2);
circle2=circle2~[circleid];
effect=2;}

plan=plan+1;
if(plan==72){plan=0;}
angleE=angleE+5;
angleE2=angleE2+5;

let magiccircle=0;
while (magiccircle<length(circle)){
if(Obj_BeDeleted(circle[magiccircle])){
circle=erase(circle,magiccircle);
magiccircle--;}
else{
let circleid=circle[magiccircle];
ObjEffect_SetAngle(circleid,80,NULL,angleE);

if(plan<=36){ObjEffect_SetLayer(circleid,1);}
if(plan>36){ObjEffect_SetLayer(circleid,2);}

ObjEffect_SetScale(circleid,scale/10,scale/10);
if(Obj_GetX(circleid)!=GetX){Obj_SetX(circleid,GetX);}
if(Obj_GetY(circleid)!=GetY){Obj_SetY(circleid,GetY);}}

magiccircle++;}

//2nd circle
let magiccircle2=0;
while (magiccircle2<length(circle2)){
if(Obj_BeDeleted(circle2[magiccircle2])){
circle2=erase(circle2,magiccircle2);
magiccircle2--;}
else{
let circleid=circle2[magiccircle2];
ObjEffect_SetAngle(circleid,80,NULL,angleE2);

if(plan>36){ObjEffect_SetLayer(circleid,1);}
if(plan<=36){ObjEffect_SetLayer(circleid,2);}

ObjEffect_SetScale(circleid,scale2/10,scale2/10);
if(Obj_GetX(circleid)!=GetX){Obj_SetX(circleid,GetX);}
if(Obj_GetY(circleid)!=GetY){Obj_SetY(circleid,GetY);}}

magiccircle2++;}

if(change==0&&constant==60){scale=scale+0.02;}
if(scale>=15&&change==0){scale=15;change=1;constant=0;}
if(change==1&&constant==60){scale=scale-0.02;}
if(scale<=10&&change==1){scale=10;change=0;constant=0;}
if(constant!=60){constant=constant+1;}

if(change2==0&&constant2==60){scale2=scale2+0.02;}
if(scale2>=15&&change2==0){scale2=15;change2=1;constant2=0;}
if(change2==1&&constant2==60){scale2=scale2-0.02;}
if(scale2<=10&&change2==1){scale2=10;change2=0;constant2=0;}
if(constant2!=60){constant2=constant2+1;}
}

Well the problem lies in the arrays because danmakufu is slower to perform the command of the second array, i've already seen that when i tried to do something with 2 lasers who had to disappear in the same time ( --> if(count==x){...} )

Then, are there any ways for me to only use magiccirle and keeping the second circle like that ?

Ooh if you have another way to do it i'm always ok the result is what needed after all...
« Last Edit: September 21, 2010, 11:37:15 AM by Leerius »

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #371 on: September 21, 2010, 12:04:14 PM »
Code: [Select]
ObjSpell_SetIntersecrionLine The fuck do i use this?
What X and Y coordinates do I put (both sets) and what the hell does "width" do?

Re: Danmakufu Q&A/Problem thread number 4
« Reply #372 on: September 21, 2010, 12:20:48 PM »
GenericTouhouFailure >
For example if you put ObjSpell_SetIntersecrionLine(obj,0,0,384,448,2,10,true);

It's like having a diagonal laser starting at (0,0) going to (384,448) doing 2 pixel width like that :

I think it's used to made a shot hitbox for like written, bomb or custom lasers.

Sure of nothing, never used but it looks like to work like that.
« Last Edit: September 21, 2010, 12:23:18 PM by Leerius »

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #373 on: September 21, 2010, 12:25:30 PM »
GenericTouhouFailure >
For example if you put ObjSpell_SetIntersecrionLine(obj,0,0,384,448,2,10,true);

It's like having a diagonal laser starting at (0,0) going to (384,448) doing 2 pixel width like that :

I think it's used to made a shot hitbox for like written, bomb or custom lasers.

Sure of nothing, never used but it looks like to work like that.
Ok. Gonna try when i'm free. (Like in two weeks time D: Examinations Shucks Bawlz)

Chau

  • Warning! Incoming Engrish post!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #374 on: September 22, 2010, 02:20:45 PM »
Hi everyone,
how do you make a looping background?

Currently I use the following method:

Code: [Select]
@DrawLoop{
SetTexture(bg);
SetGraphicRect(0,0,447,1000000);
DrawGraphic(GetCenterX,GetCenterY+scroll);
scroll=scroll+scrollspeed;
}

Are there any better ways to manage this? To me it looks really weird when I use such a big number with SetGraphicRect...

} //End of Engrish

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #375 on: September 22, 2010, 02:52:55 PM »
That's pretty much it, but you don't need that big of a number. All you need is the height of the DNH field times 2, so if your image is 447x447 you would use 0,0,447,894. What is the size of your image, though?

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #376 on: September 22, 2010, 03:02:50 PM »
@Chau

Code: [Select]
@DrawLoop{
SetTexture(bg);
SetGraphicRect(0,0 + scroll,447, 479 + scroll);
DrawGraphic(GetCenterX,GetCenterY);
scroll=scroll+scrollspeed;
}

This would be how I approach it, anyway. I prefer to move around on the image rather than where I draw it. Don't know if it'll change anything for you though.



@Leerius

I honestly can't follow what you've coded there. Other than us ranting to you about how you could tab your code better, perhaps we could better help you if you told us what your objective is with your code. What exactly are you trying to do? We may be able to give a different method of approaching it, if nothing else.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #377 on: September 22, 2010, 04:39:16 PM »
Ohai.

Seems like Leerius is trying to make a rotating magic circle that goes in front and behind the boss instead of  just rotating around the Z-axis in a flat 2D world. The way he's doing it now will never work though. What he needs is multiple images of the magic circle rotating, rather than rotating the image with Danmakufu so that half of it stays permanently in front of the Shinki and half of it permanently behind Shinki. The weird effect you're getting now is because the rotation you're giving it is causing the halves to move out of place.

In short you need to animate the rotation rather than rotate it with Danmakufu.

AND AWAY I GO TO DISAPPEAR FROM MOTK AGAIN!
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #378 on: September 22, 2010, 05:12:42 PM »
Ugh... ok thanks Blargel... won't be easy... i'll made a normal one.. xD
Too bad ...><

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #379 on: September 26, 2010, 06:07:24 AM »
I need some help on making stages.  When I create more than one of the same enemy script, and one gets destroyed by player bullets, all the enemies on the field vanish.  Also backgrounds hate me in anything other than a spellcard so could someone show me what I'm doing wrong on drawing backgrounds in the stage?

The scripts I'm using:
Stage script
enemy script

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #380 on: September 26, 2010, 07:12:40 AM »
For the first problem, each graphic can only be loaded into memory once, and loaded graphics/sounds are universal - they apply to every script that's called (stages, enemies, bosses, etc). If you call LoadGraphic(image) when the image is already loaded, it's ignored. Then, since you have DeleteGraphic(image) in finalize, that image is deleted for ALL enemies, so they vanish. The solution is to call LoadGraphic and DeleteGraphic in the stage's@Initialize and @Finalize, rather than the enemy's.

For the second problem, the G in @BackGround needs to be capitalized. Standard beginner's error; don't feel bad.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #381 on: September 26, 2010, 08:08:48 AM »
For the second problem, the G in @BackGround needs to be capitalized. Standard beginner's error; don't feel bad.
Actually, one of the tutorials (can't remember where) about stages had @Background without capital G if I am not wrong.
This needs to be found and corrected.

Fake Edit:http://dmf.shrinemaiden.org/wiki/index.php?title=Danmakufu_Intermediate_Tutorial
Too lazy to edit it though. I need to leave my house.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #382 on: September 26, 2010, 10:49:36 AM »
More of a reason not to copy/paste entire scripts. 

I am also surprised people rarely perform trial & error when they get stuck. As in, removing the last coded parts, reboot scripts > check if error > repeat until error discovered.

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #383 on: September 26, 2010, 04:48:39 PM »
Wow, I've been trying to get that drawing enemy problem to work for like 2 weeks now.  Thanks Azure!

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #384 on: September 26, 2010, 07:34:30 PM »
I've been trying to get that drawing enemy problem to work for like 2 weeks now
Today at 01:07:24 am

WHAT THE HELL MAN WHY DID YOU NOT POST BEFOREHAND
IT WOULD HAVE TAKEN LIKE THREE SECONDS TO FIND

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

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #385 on: September 26, 2010, 09:26:25 PM »
I forgot about this thread.
« Last Edit: September 26, 2010, 09:40:14 PM by Schezo »

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #386 on: September 28, 2010, 12:40:18 AM »
I really hate asking this, but can anyone find where I am missing a closing parenthesis?

http://pastebin.com/pnL7LH24

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem thread number 4
« Reply #387 on: September 28, 2010, 12:46:08 AM »
61.                Obj_SetAngle(obj, atan2(specy - Obj_GetY(obj), specx - Obj_GetX(obj) );

Re: Danmakufu Q&A/Problem thread number 4
« Reply #388 on: September 28, 2010, 12:50:29 AM »
you can't seperate parameters with a '-' , Danmakufu reads it as parameter minus another parameter. At least I think thats it, when I do that it works until the next thing-like-this comes up.

And what Bluely Blue said as well

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #389 on: September 28, 2010, 01:06:51 AM »
Goddammit, I totally forgot that. Thanks people.