Author Topic: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)  (Read 268453 times)

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #960 on: May 20, 2013, 09:40:51 PM »
By custom lasers, do you mean Object Lasers or CreateLasers? I haven't checked the code yet, but it's always helpful to know the details about what exactly you are trying to do.
I mean that I'm trying to use the "CreateLaser01" code but using custom bullets that I created as the graphic.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #961 on: May 20, 2013, 11:40:07 PM »
Then all you need to do is call LoadUserShotData(file path to a .txt file)

The .txt file should be structured as follows:

#UserShotData

ShotImage = ".\nameofimage.png"

ShotData{ id = 1 rect=(Left, Top, Right, Bottom) render=ADD/ALPHA (you choose) angular_velocity = # delay_color= (###,###,###) }

Ex: ShotData{ id=1 rect=(1,0,16,14) render=ALPHA angular_velocity = 0 delay_color= (128,128,128) }

The Left, top, right, bottom are the pixel boundaries for the graphic.

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #962 on: May 20, 2013, 11:50:51 PM »
 :( I've done that and it didn't work...

Just please view the code and please tell me what's wrong (and maybe even correct it).
« Last Edit: May 20, 2013, 11:52:42 PM by Mr. Hlaaluington »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #963 on: May 21, 2013, 12:49:45 AM »
Code: [Select]
#UserShotData

ShotImage = ".\img\laser.png"
should be
Code: [Select]
#UserShotData

ShotImage = ".\laser.png"
Basically, since the image file is in the same folder as the .txt, you just link directly. ".\" refers to the current directory that the file is in.

ALSO:
Code: [Select]
task fire{
wait(60);
let x = 0;
let dir = 0;

loop{
while(x<5){

CreateLaser01(GetEnemyX,GetEnemyY,5,(GetAngleToPlayer+rand(-45,45)),200,10,PURPLE11,0);

dir+=90/2;

x++;

}

x = 0;
dir = 0;
wait(7);
yield;

}

}


function wait(w){
loop(w){yield;}
}
Your use of White Space is extremely inefficient. I suggest pressing the space bar four times for each indent instead of spamming the tab key. I can't read your code at all. On a side note, since you're using your own shotsheet, you shouldn't use Purple11 in one script and your own shot in another. Sometimes things become problematic when you do this. Just to let you know.
« Last Edit: May 21, 2013, 12:55:28 AM by Sparen »

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #964 on: May 21, 2013, 01:56:20 AM »
Haha thanks. What a stupid mistake I made.

EDIT:
On a side note, since you're using your own shotsheet, you shouldn't use Purple11 in one script and your own shot in another. Sometimes things become problematic when you do this. Just to let you know.
I know. I just started this script yesterday, so I still have to iron out mistakes. Besides, I was keeping it that way just in case there wasn't a way to do what I wanted. I can't wait until I finish Sariel.

EDIT EDIT:
Oh pooie, I seem to need help again. Sariel's animation won't work.

http://pastebin.com/p2QqRv2v

Updated MediaFire link for the entire character: http://www.mediafire.com/download/cmhlsciqszfacfu/Sariel.rar

Please post large code like this in pastebin.com --Hele
« Last Edit: May 21, 2013, 09:09:00 AM by Helepolis »

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #965 on: May 21, 2013, 08:05:00 AM »
Code: [Select]
//GIGANTIC AMOUNT OF DRAWING CODE.
Spoiler:
Is it really needed to use int for GetSpeedX?

Also, that lump of code looks really messy and somewhat confusing because of it. I would reccomend to either use ascent loops (with linear graphic placement in the graphic file (if it isn't already) to loop through it all with just one if function) or to just use Blargels animation library which is simple and really useful.
link: http://www.shrinemaiden.org/forum/index.php?topic=4711.0

Example of ascent loop for this task:
Code: [Select]
if(GetSpeedX==0){
ascent(anim in 0..36){
if(f>=(anim*10) && f<((anim*10)+10) ){ SetGraphicRect(0+(anim*77), 0, 77+(anim*77), 64);}
 //In case each graphic is inside a square of width 77 next to each other.
 //And of course, each graphics height is supposed to be 64.
}}

Another error seems to appear, looking at your drawing code.

if(f>=40 && f<50){ SetGraphicRect(64,0,77,64); }
if(f>=50 && f<60){ SetGraphicRect(64,77,77,64); }

(( SetGraphicRect(First X coordinate, First Y coordinate, Second X coordinate, Second Y coordinate); ))

Which means that first Y1 first is above Y2, which later changes to Y2 being above Y1. This will probably shrink and/or invert the graphic, since all graphicrects are not of the same scale/angle.
The same thing happens later to your x coordinates as well. I assume you forgot to increase the second X and Y values as well?
« Last Edit: May 21, 2013, 08:51:14 AM by Darkness1 »

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #966 on: May 22, 2013, 12:42:07 AM »
Another error seems to appear, looking at your drawing code.

if(f>=40 && f<50){ SetGraphicRect(64,0,77,64); }
if(f>=50 && f<60){ SetGraphicRect(64,77,77,64); }

(( SetGraphicRect(First X coordinate, First Y coordinate, Second X coordinate, Second Y coordinate); ))

Which means that first Y1 first is above Y2, which later changes to Y2 being above Y1. This will probably shrink and/or invert the graphic, since all graphicrects are not of the same scale/angle.
The same thing happens later to your x coordinates as well. I assume you forgot to increase the second X and Y values as well?

I did forget to do that, I'll go see if it works.

EDIT: I finally got it to work using ascent. Thanks for your help. Now I am finally done with 2 attacks.

EDIT EDIT:

Fudgelcakes, my familiar won't spawn (gawd I suck at this).

http://pastebin.com/mwKah5Mj

This is the second time I have to edit your post to put it in paste.bin. -Hele
« Last Edit: May 23, 2013, 06:29:50 AM by Helepolis »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #967 on: May 23, 2013, 06:29:33 AM »
Mr. Hlaaluington, please keep in mind that posting blocks of code like that will cause immense number of scrolling for just 1 post. Please be sure to put those next time in Pastebin.com.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #968 on: May 23, 2013, 10:11:45 AM »
Maybe you should try finding errors using danmakufus own error messages sometimes. Just saying, it is helpful for the less complicated errors.
Anyways:
* DrawGraphicRect(imgDerp); //This seems strange.
* Looking at your graphic ascent loop this time, it doesn't seem wrong and I don't know how your graphic file looks, but when you increase both the x and the y coordinates per loop, it makes me wonder if your graphics are lined diagonally.
* In maintask, it looks like you are calling the task fire one frame before you are creating it, since the task is inside maintask. Not only that, maintask covers all the other tasks after it, which is also wrong.
* This is not a real error, but it seems unneccesary to use a while loop for the bullets, since you might as well use the loop/ascent/descent functions. Using ascent/descent, you even get a value for each loop which can be used for making angle patterns.
* There needs to be yield; in your mainloop to run tasks.
* Why are there so many brackets at the end?

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #969 on: May 24, 2013, 05:23:52 AM »
This is probably an incredibly silly question, but is there any functional difference between "loop" and "times"? Thanks in advance~

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #970 on: May 24, 2013, 05:41:56 AM »
Literally no difference. It's just equivalent syntax, except loop can be done indefinitely while times requires a count.

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

The Noodles Guy

  • Flip the screen
  • What if Seija met a guy with bipolar disease?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #971 on: May 25, 2013, 11:01:48 AM »
How do I use loops? :V
Easy Modo? That's for kids, and for me.

PhantomSong

  • The Ghost Living through Everyday Life.
  • Eh, it doesn't matter.
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #972 on: May 25, 2013, 02:32:38 PM »
How do I use loops? :V
Well loops will repeat things over and over, and are pretty standard.

Code: [Select]
//This'll loop everything in here and "loop de loop(20)"
loop{
        //This will loop whatever is in this bracket 20 times.
        loop(20){

    yield;
      }
yield;
}

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #973 on: May 25, 2013, 02:34:48 PM »
@Berthold: What do you mean with that? A short explanation:
Code: [Select]
loop(n){stuff;} does "stuff" n times. Example:
Code: [Select]
loop(8){CreateShot01(GetX,GetY,3,rand(0,360),BLUE12,0);}spawns eight BLUE12 bullets from the boss's location at speed 3, no delay, and at random angles.
You may change variables in a loop. A basic example:
Code: [Select]
let angle=rand(0,360);
loop(15)
{
CreateShot01(GetX,GetY,3,angle,BLUE12,0);
angle+=360/15;
}
This spawns a circle of 15 blue bullets. The bullets are equal except for the fact that they're fired at different angles.
Code: [Select]
loop{stuff;} is an infinite loop. It will crash Danmakufu unless you use it in a task and put at least one yield in it. If you use tasks, don't forget to put at least one yield in your @MainLoop!
Anyway, read the tutorials for more and better information about loops.

The Noodles Guy

  • Flip the screen
  • What if Seija met a guy with bipolar disease?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #974 on: May 25, 2013, 03:14:49 PM »
Thanks Maths and Phantom :3
Easy Modo? That's for kids, and for me.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #975 on: May 25, 2013, 06:41:28 PM »
I hope I'm not getting annoying with my abuse of ascent, but to explain, there are three other types of loops which are useful in their own circumstances.
Code: [Select]
ascent( [name of variable saved with each loop] in [startingvalue of loop]..[lastvalue of loop] ){ dostuff; }
descent( [name of variable saved with each loop] in [startingvalue of loop]..[lastvalue of loop] ){ dostuff; }
while( [something] ){ dostuff; }

Basically, ascent and descent goes through set values as it loops, except that ascent is supposed to go up upwards and descent downwards. Example usage is something like this:
Code: [Select]
ascent(angletime in 0..15){ CreateShot(); }Which will create 15 bullets, where each bullet gets a stored value of 0 up to 14. The stored number can then be called by using "angletime" inside the ascent loop. If you want a simple ring pattern of 15 bullets, you can put the bullets angle as angletime*360/15.

While should be obvious how to use, as it simply does an infinite loop as long as the statement in the parentheses are true. Using infinite loops like "while" or "loop", you can then use the break; function to exit the loop. An example of mine: 
Code: [Select]
let randangle=270;
loop{randangle=rand(220,320);
if(randangle!=270){break;}}
Which would infinitely loop to give randangle a random value between 220 and 320 until the value randangle is not equal to 270.
« Last Edit: May 25, 2013, 09:48:37 PM by Darkness1 »

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #976 on: May 25, 2013, 09:28:08 PM »
No, Dark, you're not getting annoying. It's great that you point out the other types of loop  :D Personally, I don't use ascent/descent loops much, but I understand why you find them practical.
Berthold, feel free to test them. It's not that hard and you may find it practical. Also, I highly recommend looking at while loops. They're useful in different circumstances than loop/ascent/descent, so they're nice to know about.
Oh, and regarding the previous post: You're welcome :)

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #977 on: May 25, 2013, 11:44:48 PM »
yield
You don't need to yield in loops. It's only necessary if you're buffering each loop over a period of frames. This is standard with "run-per-frame" loops but isn't necessary in general. I'm sure you know that but pointing it out anyway.

Using infinite loops like "while" or "loop", you can then use the break; function to exit the loop.
Nooooo. If you're using a while loop to conditionally run some looping statements, you don't break unless for some reason you have to exit the loop before hitting the next iteration. Otherwise whatever condition that you're using to break should be going in the while condition. Likewise, if you need to use a break for a loop, you better have a good reason for doing it and not just using a while loop under your break condition.

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

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #978 on: May 28, 2013, 09:25:35 AM »
Nooooo. If you're using a while loop to conditionally run some looping statements, you don't break unless for some reason you have to exit the loop before hitting the next iteration. Otherwise whatever condition that you're using to break should be going in the while condition. Likewise, if you need to use a break for a loop, you better have a good reason for doing it and not just using a while loop under your break condition.
I realise my use of break there was unneccesary, when I could aswell have used the while function, but atleast I could use it to show how break works. I could have made a better example, but still.

Now for something I have thought about for a while, how do you bend graphics into circles using effect objects, to make effects like ZUNs spellcard circles or the healthbar/circle from TD?
« Last Edit: May 28, 2013, 09:27:20 AM by Darkness1 »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #979 on: May 28, 2013, 09:58:30 AM »
Triangle strip where each "piece" (Vertexes) of the strip is placed in a circular shape using trig. The more pieces, the smoother the circle becomes. Then you apply the texture over the pieces. Currently I don't have access to my project where I could show an example, because I have implemented this in my game, with some additional effects.

Isn't also the circular lifebar made by someone on bulletforge? You might want to download that and study the code if you don't wish to wait.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #980 on: May 28, 2013, 04:33:29 PM »
Triangle strip where each "piece" (Vertexes) of the strip is placed in a circular shape using trig. The more pieces, the smoother the circle becomes. Then you apply the texture over the pieces. Currently I don't have access to my project where I could show an example, because I have implemented this in my game, with some additional effects.

Isn't also the circular lifebar made by someone on bulletforge? You might want to download that and study the code if you don't wish to wait.
I don't know about the circular lifebar, I looked at shockmans code for the mima script but it was quite different from an effect object.

I did follow your hint and tried to make something: http://pastebin.com/fV9Qj5e2

It does make a circle, but the circle shrinks at the start and at 180 degrees from the start of the circle. There seems to be something weird with vertex 0 and 1 aswell.
It is very possible that I don't understand the way vertexes go together here.
« Last Edit: May 28, 2013, 04:37:30 PM by Darkness1 »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #981 on: May 28, 2013, 11:40:43 PM »
I don't know about the circular lifebar, I looked at shockmans code for the mima script but it was quite different from an effect object.

I did follow your hint and tried to make something: http://pastebin.com/fV9Qj5e2

It does make a circle, but the circle shrinks at the start and at 180 degrees from the start of the circle. There seems to be something weird with vertex 0 and 1 aswell.
It is very possible that I don't understand the way vertexes go together here.


Shockman's Mima uses a circular lifebar. I have altered it and found it to be quite useful. It's in PDD v0.50, I think. Go to Data=>Stgenemy=>stgenemy.txt. It's the second function there. The first one is my own lifebar, which is just a plain old Marine Benefit-esque lifebar with ZUNgraphics.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #982 on: May 29, 2013, 05:22:10 AM »
Shockman's Mima uses a circular lifebar. I have altered it and found it to be quite useful. It's in PDD v0.50, I think. Go to Data=>Stgenemy=>stgenemy.txt. It's the second function there. The first one is my own lifebar, which is just a plain old Marine Benefit-esque lifebar with ZUNgraphics.
I did check shockmans script for it first, but it put me off a bit how it was a big bunch a drawn images. I wanted to see if it could be made purely with vertexes (I'm not sure, but does it cause less lag in this case?) since I also wanted to use the code later for spellcard circles. As I said, my code seems to make a circle, but since the vertexes with the graphic doesn't bend, the circle effect object gets thinner and thinner the more the circle curves away from the current angle of the graphic. Right now, I suppose it is to find a way to make the ingame drawn width/length be dependant on it's position on the circle. That is, if my idea for scripting the vertexes together really works.

EDIT: looked at Onthenets script a bit and it works alot better now. Just have to figure out the life code.
EDIT2: It became something like this. Unfortunately, this doesn't work too well. http://pastebin.com/MrJPi680 A vertex seems to behave strangely.
« Last Edit: May 29, 2013, 08:47:50 PM by Darkness1 »

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #983 on: May 30, 2013, 03:09:21 AM »
I'm stuck on a piece of coding that would have been easy to make.
So, I'm trying to make the boss have a fast bullet streams on her left and right.
I want the right stream to start at 180 and add angle until it gets to 90. That part I got, but then, I also need it to accelerate the distance between each bullet at the beginning, keep a regular interval in the middle, and decrease distance at the end.
http://pastebin.com/zy8kZuxi
This was my attempt with very specific variable changing and "If" statements.
Currently a normal player

Zoriri

  • Danmaku Trainee
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #984 on: June 04, 2013, 12:06:37 AM »
I have a couple of questions about the graphical side of danmakufu.
1.) How do you change the graphic for concentrations?
2.) Do boss portraits need to be a specific file type? I'm using a .PNG file, but it appears as a white block.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #985 on: June 04, 2013, 12:10:18 AM »
I have a couple of questions about the graphical side of danmakufu.
1.) How do you change the graphic for concentrations?
2.) Do boss portraits need to be a specific file type? I'm using a .PNG file, but it appears as a white block.

1) Either override using an img folder with a corresponding file OR use object effects and recreate the effect
2) Incorrect dimensions, most likely. Check your dimensions and make sure that you've a) Loaded the graphic and b) used the correct filepath.

For help on Filepaths: Helepolis's Paths and Directories Tutorial

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #986 on: June 04, 2013, 02:10:13 PM »
Additional info on the concentration: http://www.shrinemaiden.org/forum/index.php/topic,3167.0.html   This thread explains what the names are of the image files inside dnh. You need to create the same folder in the root of Danmakufu.


Zoriri

  • Danmaku Trainee
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #987 on: June 04, 2013, 10:12:25 PM »

1) Either override using an img folder with a corresponding file OR use object effects and recreate the effect
Additional info on the concentration: http://www.shrinemaiden.org/forum/index.php/topic,3167.0.html   This thread explains what the names are of the image files inside dnh. You need to create the same folder in the root of Danmakufu.

So to change the concentration effect, I put the graphic i want into the img. folder, and then call it in the script?

PhantomSong

  • The Ghost Living through Everyday Life.
  • Eh, it doesn't matter.
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #988 on: June 04, 2013, 10:36:56 PM »
So to change the concentration effect, I put the graphic i want into the img. folder, and then call it in the script?
Precisely!
So let say you wanted to  change the snowflake one into cherry blossoms. Change the graphic and call "Concetration02(##)" where you want it.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #989 on: June 04, 2013, 10:39:47 PM »
The coordinates of the graphic need to match up though. Keep that in mind, since replacing Danmakufu's native files can be problematic sometimes.