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

Formless God

Re: Danmakufu Q&A/Problem thread number 4
« Reply #180 on: July 27, 2010, 02:50:00 AM »
Oh, it's the wavering background.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #181 on: July 27, 2010, 04:01:14 AM »
Oh, it's the wavering background.

Ah.
I think this is possible, but will cause a shitload of lag.

It's been discussed on IRC some day, I forgot when, but it has.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #182 on: July 27, 2010, 11:11:30 AM »
It would be possible with render targets, effect objects, and lots of math. I highly recommend you not to try it, though.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #183 on: July 27, 2010, 11:21:28 AM »
It was something along the lines of...

Make a render target. Draw everything related to backgrounds onto this render target. Use the render target as the graphic for an effect object. Give the object zig vertices. Make them behave accordingly.


Yeah, it is difficult...


And @ Sparkling Orange: If you have a single task that creates, manages and removes one of your effect objects, calling this task several times should not cause any problems at atll because the variable that holds the id of the object, in your case "objlightning", is created withing the task and thus is unaffected by code outside of it, even the code of seperate other running instances of the same task.

Did you put the code I posted at the right places? Both parts should go in task LightningRipple(xpos){, the first one before the while{} brackets, the second one inside the while{} brackets just before the yield;.
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."

electron9186

Re: Danmakufu Q&A/Problem thread number 4
« Reply #184 on: July 28, 2010, 08:35:00 PM »
I'm trying to make a script with an object shot, but I keep getting an error message that says I need a bracket even when I'm sure my brackets are corredt. I even tried the object code in a task, but that did no good. Can somebody help?

Code:
Code: [Select]
#TouhouDanmakufu
#Title[spellcard]
#Text[blablabla]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let angle = 0;
    let sword = "img\SwordandStuff.bmp";
    @Initialize {
        SetLife(1000);
        SetEnemyMarker(true);
        SetScore(500000);
       
    }

    @MainLoop {
        CreateShotA(1, GetX, GetY, 20);
        SetShotDataA(1, 0, 2, 90, 0, 0, 2, GREEN03);
        SetShotDataA(1, 30, NULL, NULL, 0, -0.025, 0, YELLOW03);
        SetShotDataA(1, 90, 0, 45, 0, 0.05, 2, YELLOW02);
        SetShotKillTime(1, 240);
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
            if(frame==300){
let obj = Obj_Create(OBJ_SHOT));
Obj_SetPosition(obj, GetX, GetY);
Obj_SetSpeed(obj, 4);
Obj_SetAngle(obj, GetAngleToPlayer);
ObjShot_SetDelay(obj, 10);
ObjShot_SetGraphic(obj, sword);
FireShot(1);
                frame = 0;
            }
        frame++;
        }

    @DrawLoop {       
    }

    @Finalize {
    }

}

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #185 on: July 28, 2010, 08:36:40 PM »
Are not.

let obj = Obj_Create(OBJ_SHOT));

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

electron9186

Re: Danmakufu Q&A/Problem thread number 4
« Reply #186 on: July 28, 2010, 08:41:09 PM »
*sees mistake*

Wow, you guys are good... :blush:

That leaves me to wonder, though... Why did the error message say I needed a bracket when the problem was having one too many parentheses?

Weird.

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #187 on: July 28, 2010, 08:45:44 PM »
It's Danmakufu. Most of us don't really care why things happen anymore.

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

SparklingOrange

  • Is a scrub.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #188 on: July 30, 2010, 05:24:29 PM »
It was something along the lines of...

Make a render target. Draw everything related to backgrounds onto this render target. Use the render target as the graphic for an effect object. Give the object zig vertices. Make them behave accordingly.


Yeah, it is difficult...


And @ Sparkling Orange: If you have a single task that creates, manages and removes one of your effect objects, calling this task several times should not cause any problems at atll because the variable that holds the id of the object, in your case "objlightning", is created withing the task and thus is unaffected by code outside of it, even the code of seperate other running instances of the same task.

Did you put the code I posted at the right places? Both parts should go in task LightningRipple(xpos){, the first one before the while{} brackets, the second one inside the while{} brackets just before the yield;.
Oops, I placed the variables at the beginning of the spell script...didn't know it would make a difference if I put it locally in the task. It works now, but say what if I wanted the effect object to have an additive blend? That, or I'd have to shave off more of the black in the texture 'cause it still looks ugly. If only there's a site somewhere that contains good textures to use, especially scrolling scenery textures.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
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."

Beef Owl

  • Why yes, owls do yield beef:
  • It is known as The Strongest White Meat
Re: Danmakufu Q&A/Problem thread number 4
« Reply #190 on: August 04, 2010, 12:56:17 AM »
This is probably a really stupid question, but is it possible to concatenate strings into method calls?

Like if I wanted a random generator to set a variable to a number rand(1,100) and then called a method corresponding to it, (Like "Function" + i) how (if at all) could that kind of code be written? I'd rather try not having a 100-case switch statement running every second or two if I can avoid it  :V

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #191 on: August 04, 2010, 01:03:27 AM »
The ~ character can be used to concatenate strings. "string1"~"string2" would return "string1string2". However, function/sub/task/variable names are not strings, so if I'm understanding your question correctly, you'll have to use a switch.

Lord Phantasm Satori

  • Permabanned
  • RIP 7/21/2010-9/10/2010
Re: Danmakufu Q&A/Problem thread number 4
« Reply #192 on: August 04, 2010, 01:10:27 AM »
Is it possible to make a game with Danmakufu that doesn't require the engine? I plan to eventually sell something I make and I won't make much money if all my customers had to do that "app locale" thing.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #193 on: August 04, 2010, 01:17:45 AM »
No.

Beef Owl

  • Why yes, owls do yield beef:
  • It is known as The Strongest White Meat
Re: Danmakufu Q&A/Problem thread number 4
« Reply #194 on: August 04, 2010, 01:19:40 AM »
The ~ character can be used to concatenate strings. "string1"~"string2" would return "string1string2". However, function/sub/task/variable names are not strings, so if I'm understanding your question correctly, you'll have to use a switch.

Oh, shoot, it's a tilde in danmakufu? I thought it was either with   pluses or ampersands  :derp: and dammit, figures as much.   Whatever, guess I'll just make a massive switch statement :V

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #195 on: August 04, 2010, 01:30:40 AM »
Is it possible to make a game with Danmakufu that doesn't require the engine? I plan to eventually sell something I make and I won't make much money if all my customers had to do that "app locale" thing.

You can just set up everything so there's only one selectable script, then tell the user "press Z repeatedly until you get to a screen that's not blue." If you delete the default Rumia scripts and don't use any Japanese characters in yours, they won't need applocale.

Lord Phantasm Satori

  • Permabanned
  • RIP 7/21/2010-9/10/2010
Re: Danmakufu Q&A/Problem thread number 4
« Reply #196 on: August 04, 2010, 05:10:13 AM »
then its not a game engine really.

Formless God

Re: Danmakufu Q&A/Problem thread number 4
« Reply #197 on: August 04, 2010, 06:05:17 AM »
It's not your game engine.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #198 on: August 04, 2010, 04:18:03 PM »
Question 1: Graphical issue with Dnh it self:

When I enlarge the screen (not full screen) the entire view looks pixelated/ugly but in full screen, everything is looking smooth/nice. I don't have this issue on my laptop so I am suspecting video graphical settings/drivers/options. Though I could vaguely remember if I had this issue when I installed my new pc for the first time.

Any ideas?

Question 2:  Math + Helepolis = Failure. (solved)
I want to mimic CreateShotA_XY as Object bullets to create the "fountain" effect for it (again yes). Knowing CreateShotA_XY has 9 parameters (ID, time to change, x-velocity, y-velocity, x-acc, y-acc and maximum x / y acceleration and finally the graphic.) Guessing trig is my friend, but no matter how much I fiddle, I cannot succeed anything close to it. Here is what I tried in despair. You may laugh now.

Code: [Select]
  task testShot(x,y,v,dir,xacc,yacc,maxXacc,maxYacc,kleur,delay){
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj,x,y);
    Obj_SetSpeed(obj,v);
    Obj_SetAngle(obj,dir);
    ObjShot_SetGraphic(obj,kleur);
    ObjShot_SetDelay(obj,delay);

    while(!Obj_BeDeleted(obj)) {
Obj_SetX(obj,Obj_GetX(obj)+v*cos(dir));
Obj_SetY(obj,Obj_GetY(obj)+v*sin(dir));
dir++;
yield;
    }
  }
« Last Edit: August 04, 2010, 09:36:24 PM by Helepolis »

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #199 on: August 04, 2010, 05:13:38 PM »
For problem 2, have separate X and Y velocities.
Code: [Select]
  task testShot(x,y,xv,yv,xacc,yacc,maxXacc,maxYacc,kleur,delay){
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj,x,y);
    Obj_SetSpeed(obj,0);
    ObjShot_SetGraphic(obj,kleur);
    ObjShot_SetDelay(obj,delay);

    while(!Obj_BeDeleted(obj)) {
   Obj_SetX(obj,Obj_GetX(obj)+xv);
   Obj_SetY(obj,Obj_GetY(obj)+yv);

   xv+=xacc;
   yv+=yacc;

   Obj_SetAngle(obj,atan2(yv,xv));
   yield;
    }
  }

This is untested, but it should work unless I'm still too tired to think. This won't cap the numbers at the maximum, but I'm sure you can figure that out on your own. The bullet's display angle might be reversed too, but that should also be easy to fix.

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #200 on: August 04, 2010, 05:24:27 PM »
ignore this post, found a blatant error
« Last Edit: August 04, 2010, 05:37:12 PM by Flashtirade »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #201 on: August 04, 2010, 05:57:17 PM »
For problem 2, have separate X and Y velocities.
Code: [Select]
< code >

This is untested, but it should work unless I'm still too tired to think. This won't cap the numbers at the maximum, but I'm sure you can figure that out on your own. The bullet's display angle might be reversed too, but that should also be easy to fix.

Bullet is moving regular to the given velocity direction, it is not de-accelerating to drop down again.

If I look at the code from my Afro boss (which Iryan I think solved for me back then): SetShotDataA_XY(5,0,speed*cos(rand(265,275)),speed*sin(rand(265,275)),0,0.04,0,rand(0.3,3),205);

Then I really suspect somewhere trig has to be applied, or am I plain wrong =|

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #202 on: August 04, 2010, 06:11:15 PM »
X-acceleration should be 0, while Y-acceleration should be positive and Y-speed should start out negative. If you're doing that but it doesn't work, then there's something wrong with my code that I'm overlooking...
Trig COULD be used for this, but having separate x and y speed variables is the easier way in my opinion. You just need trig so the graphic rotates correctly.
Edit: note that I changed the velocity and angle parameters to be x-velocity and y-velocity instead. I should have specifically pointed it out.
« Last Edit: August 04, 2010, 06:24:03 PM by Azure Lazuline »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #203 on: August 04, 2010, 09:34:44 PM »
Question 2 issue solved on IRC after intensive Helepolis-being-idiot session. Thanks Azure and Iryan.

Question 1 isn't really dramatic, but if anybody has an idea, else I am just going to perform driver updates I guess and see if that helps.

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #204 on: August 04, 2010, 11:05:51 PM »
Sorry, can I post here a little problem with my script? I have searched but I didn't found anything could help me. I have read rules but I don't know if this is the right section...I don't want make problems so
if(this==the right section){I post my script}else if{I cry and ask where the section is}
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #205 on: August 04, 2010, 11:09:33 PM »
This is the right thread, so go ahead and ask.

Just make sure you give us as much information about your script and problem as possible so we can help you more efficiently.  BV
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."

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #206 on: August 04, 2010, 11:23:49 PM »
Thanks to all now my script work! It's pretty easy for now but with two or theee get angle to player it will be fun! [Two or threee? Like when i put yield after every "}" (I have resolt  it!)] however thanks again!
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #207 on: August 05, 2010, 12:17:10 AM »
That code I posted earlier and then removed? I've been tinkering with it for hours now, but the problem is not solved at all.
I was attempting to make an object version of CreateShot02, and so far I have this. It's got tons of (unnecessary?) stuff inside so I'll explain.
See it here.

If you can make sense of the code on its own, you can skip this section. Otherwise, read on.
Spoiler:
First things first, the user-defined variables. Pretty self-explanatory.
Under that, there are more variables.

shottimer = serves the same function as a timer variable in the MainLoop (not active here, so ignore please)
delaycount = aids in delaying the shot from moving (not the problem, so ignore also)
signfinder = using the startingspeed and minmaxspeed, becomes a positive or negative number to be used in determining plausibility of the user-defined accel value
calcspeed = non-permanent value that determines the current speed of the bullet, at start it is set to the starting speed

Now within the while loop.
The if statement is for delay. There are no problems with it.
The else statement:
- The first if statement is pretty self-explanatory. Any of the three values would do, but I just picked that one.
- The embedded else statement is for when the startingspeed is not equal to the minmaxspeed, and is most likely the source of my troubles.

[The following section is how I thought it would work.]
+ If the signfinder is less than 0, then it would mean that the acceleration value would have to be negative. However, I also have to check if the current speed is greater than the minimum speed. If it is, then I would add the current speed with the negative acceleration so it would slow down. If the current speed had equaled or exceeded the minimum value, then it would stay at that speed. I even put in a joke error message that would come up if the acceleration value given was not negative.
+ The second part is the exact same, but just working with positive acceleration.

However, this is not the case. No matter what plausible values I plug in, the bullet will only move at the startingspeed. Implausible values do trigger the error message, so that signals that the code is running, but I can't get the bullet to go any faster or slower.

Any advice?

Re: Danmakufu Q&A/Problem thread number 4
« Reply #208 on: August 05, 2010, 03:23:12 AM »
I got nothing, sorry Flashtirade.


I have been lectured at about this many, many times, but I still can't quite get it.

What is the Correct way to tab a script? So I can make it more readable to others rather than myself.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #209 on: August 05, 2010, 03:36:46 AM »
Basically, every time you open a brace (curly bracket), tab everything in them once. If you open more than one, tab more than once. This way, the structure of the code is much easier to read, and it's easier to tell if you mess up a brace. Aside from that, everyone is slightly different, so use whatever you think makes it the most readable. Example:
Code: [Select]
function something(par1,par2){
DoSomething;
loop(3){
loop(10){
Bullet;
var++;
}
DoSomethingElse;
}
}