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

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #420 on: July 10, 2011, 01:54:48 PM »
It's possible to save variables to a file, using common data. That will only save the scores for one computer, though - there's no way to have an online database or anything like that (unless you used FTP or something to automatically upload and download that file, but that's getting pretty ugly). Just saving the top scores is fairly easy for what I assume your programming skill is, though. The only downside is that you need to write all your own menus (and your own text-display function to show the scores), since Danmakufu just loads a single boss or stage.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #421 on: July 10, 2011, 11:23:44 PM »
How do I get these circles to stop and/or bounce of walls? The GetClip functions don't seem to be reading for some reason, and the if statement I tried is also ignored...anyone have any ideas? Knowing my luck, it's yet another misplaced yield >.< On a side note, simply doing something like

if(Obj_GetY(obj) < GetClipMinY){

Obj_SetAngle(obj,-dir)

}

Did not work either >.< (Link to script: http://pastebin.com/e4Mh3t7e)

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #422 on: July 10, 2011, 11:31:21 PM »
Think about it logically. If, say, a bullet is heading in the 30-degrees direction, which is a little lower than straight right, and it hits the wall, it becomes -30 degrees. You can't really say that angle would accurately portray a bounce.

Try angle-180 for exact direction flips.
180-angle is a more realistic bounce for walls.
360-angle for more realistic ceiling/floor bounces.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #423 on: July 10, 2011, 11:36:55 PM »
Ok, but my problem is that the bullets don't even bounce when they hit the walls, regardless of what I enter in the if loop...II have the same problem with all but the first if loop...what am I doing wrong?

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #424 on: July 10, 2011, 11:56:18 PM »
Ok, but my problem is that the bullets don't even bounce when they hit the walls, regardless of what I enter in the if loop...II have the same problem with all but the first if loop...what am I doing wrong?

Could you perhaps show us your current code for the bouncing action? Pastebin it without the rest of the script, it makes it much more manageable to read over, in my opinion. I've had some experience with bouncing rings of bullets, so I should be able to help you out.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #425 on: July 11, 2011, 12:02:44 AM »
http://pastebin.com/ezeeSCV9 Here is everything from the fire task. I appreciate your help!

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #426 on: July 11, 2011, 12:04:52 AM »
Man, I'm not used to reading pastebin code!

Anyway, a few things:
-Wait is the same thing as yield. Putting yield; after a wait(60); is the same thing as writing wait(61);
-Yield is not needed for loops that do everything inside all at once.


Quite honestly, though, I think there's more than one logic error in your script. It's hard to say what's causing you the real problem. But from what I can understand, try to rewrite your bullet code so that all movement is based on the bullet's Obj_GetAngle. You know, throw in a bit more sin/cos math. That might fix things.

Oh, and don't put infinite loops within your object bullet codes - Besides the typical while(!Obj_BeDeleted(obj)). That'll most likely mess stuff up.

EDIT : Well, I guess I can't really call it an infinite loop now. >_>
« Last Edit: July 11, 2011, 01:05:29 AM by KrackoClock »

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #427 on: July 11, 2011, 12:22:57 AM »
if you have a while(!objbedeleted) loop then by definition it isn't an infinite loop, even you plan to have it run forever it requires putting yields in the script which makes it not an infinite loop

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #428 on: July 11, 2011, 01:32:43 AM »
Thanks for the yield suggestion ^_^ So about the rest of the loops...

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #429 on: July 11, 2011, 07:20:02 AM »
I think I'm reading things correctly, but when you have it looking like this in your object shot tasks...

Code: [Select]
while(!Obj_BeDeleted(obj))
{
      if()
      {
          loop(){}
      }
      if()
      {
          loop(){}
      }
      yield;
}

...the execution of your code will never ever leave one of those loops (and thus the if-statement that holds it) once it is entered. You should use the while-statement itself as all the looping action that's required in this case since you want it to monitor several different conditions at the same time.

Code: [Select]
while(!Obj_BeDeleted(obj))
{
      if(Obj_GetX(obj)<GetClipMinX){*reverse angle mumbo-jumbo*}

      if(Obj_GetX(obj)>GetClipMaxX){*see above*}

      if(Obj_GetY(obj)<GetClipMinY){*see above*}
     
      if(Obj_GetY(obj)>GetClipMaxY){*see above*}

      yield;
}

The while-loop above lets your bullet have a frame-by-frame overview of whether it has fulfilled one of the if-conditions or not, which is what you want.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #430 on: July 11, 2011, 11:43:02 AM »
Yeah I assumed I would have to write my own menus. Pretty sure I understand the basics of them, although from what I understand so far it seems that there isn't any way to bypass that initial "Choose your character" in Danmakufu? Or is there a way to choose your character in a menu you make yourself?

Thanks, just read up on the Common Data functions. I'm guessing I would use the GetScore function as the value for the data I'm saving.

What I just tried was

SetCommonData("Score",GetScore);
SaveCommonData;

Which was placed in the @Finalize.
It didn't cause a crash (which was promising), but a quick look in the resulting .dat file via Notepad didn't reveal any significant input; just a small portion of gibberish characters.
Is that code that I'm using right? I would have written something to get the score from the file, but couldn't think of how to do it.

It's possible to save variables to a file, using common data. That will only save the scores for one computer, though - there's no way to have an online database or anything like that (unless you used FTP or something to automatically upload and download that file, but that's getting pretty ugly). Just saving the top scores is fairly easy for what I assume your programming skill is, though. The only downside is that you need to write all your own menus (and your own text-display function to show the scores), since Danmakufu just loads a single boss or stage.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #431 on: July 11, 2011, 01:45:26 PM »
http://pastebin.com/d4Bwd13d Ok, I tried the if loops, but now the bullet won't even move after 600 frames >.< Any ideas?

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #432 on: July 11, 2011, 02:24:52 PM »
http://pastebin.com/d4Bwd13d Ok, I tried the if loops, but now the bullet won't even move after 600 frames >.< Any ideas?

That's probably because of the Obj_SetPosition inside the t==600-delay if-statement. Since t will only ever equal '600-delay' once, the objects position will be set at those coordinates and then remain there. Try changing the if-statement to read:

Code: [Select]
if(t>=600-delay)

...which will have the function inside it performed once per frame after t has reached its destination value.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #433 on: July 11, 2011, 04:12:43 PM »
Yeah I assumed I would have to write my own menus. Pretty sure I understand the basics of them, although from what I understand so far it seems that there isn't any way to bypass that initial "Choose your character" in Danmakufu? Or is there a way to choose your character in a menu you make yourself?

Thanks, just read up on the Common Data functions. I'm guessing I would use the GetScore function as the value for the data I'm saving.

What I just tried was

SetCommonData("Score",GetScore);
SaveCommonData;

Which was placed in the @Finalize.
It didn't cause a crash (which was promising), but a quick look in the resulting .dat file via Notepad didn't reveal any significant input; just a small portion of gibberish characters.
Is that code that I'm using right? I would have written something to get the score from the file, but couldn't think of how to do it.
You did it right. If you put LoadCommonData at the beginning of the script now, you can then use score = GetCommonDataDefault("Score",0); to load the score into that variable for display somewhere. GetCommonDataDefault is used instead of just GetCommonData: the second parameter controls what the default value is whenever the common data exists, which in this case is the first time playing - the high score should be zero.

For the character select, there's no way to bypass it, but you can limit it to just one character of your creation. Common data again - note that common data is completely universal, so if you do something in the menu that does SetCommonData("Character",1); you can have the player react to that and change to the first character, or change to another character if it's 2 and so on.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #434 on: July 11, 2011, 04:42:05 PM »
That's probably because of the Obj_SetPosition inside the t==600-delay if-statement. Since t will only ever equal '600-delay' once, the objects position will be set at those coordinates and then remain there. Try changing the if-statement to read:

Code: [Select]
if(t>=600-delay)

...which will have the function inside it performed once per frame after t has reached its destination value.

The circle still won't move after 600 frames...it just remains stationary...All I changed was the delay code.  ???

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #435 on: July 11, 2011, 05:52:13 PM »
The circle still won't move after 600 frames...it just remains stationary...All I changed was the delay code.  ???

The circle moves for me, although I'm not quite sure what you want to have done with it. Could you perhaps pastebin the entire script code this time, and I'll paste it into my own file(s) and try it out.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #436 on: July 11, 2011, 06:32:25 PM »
Here it is: http://pastebin.com/s1dvtuW8

So do the circles bounce for you too? Thanks for the help :)

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #437 on: July 11, 2011, 06:55:18 PM »
The circles does not bounce yet, but they do start to move after the specified amount of time. I'd like to know what your plans for them are, though. The ring on the right travels up-right while the left ring goes up-left. Do you want them to bounce in such a way that they'll come back down towards the player?

Edit: got my left and right mixed up.  :V

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #438 on: July 11, 2011, 07:02:26 PM »
Yeah, that's what I'm aiming for...I want them to bounce off all of the walls in different ways...but that's essentially my goal. Wonder why the circles in my script won't move...

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #439 on: July 11, 2011, 07:29:16 PM »
That was my mistake, sorry. I misunderstood your code when I first looked over it, and my solution wasn't completely compatible with yours. I've remade your code slightly. It's no more than a base for you to continue building from, but the rings are now bouncing as they should from all borders. Please let me know if anything looks strange.

http://pastebin.com/JhC9uFhg

Also, you can take a look at one of my own scripts below. It's a bit messier than it ought to be, but the whole bouncing-rings-thing was a whole new experiment for me as well back then.

http://pastebin.com/BParnQkL

It produced the ring sequence you can see in this video.

http://www.youtube.com/watch?v=zbZF90cIsaM&t=1m55s

Pretty funky, if you ask me.  :]


Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #440 on: July 11, 2011, 08:29:37 PM »
For some reason, the bullets don't even spawn at the moment :/ Ideas? That's a pretty wicked script!

TheMasterSpark

  • Lunatic lemurialist
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #441 on: July 11, 2011, 09:14:16 PM »
Oh right, I changed path to your ShotData on line 33 in the pastebin. You'll need to remove the 'system/' bit of it, I only needed it in order to fit my own folder structure.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #442 on: July 11, 2011, 10:38:36 PM »
IT FINALLY WORKS :D THANK YOU SO MUCH!!!

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #443 on: July 12, 2011, 01:53:41 AM »
And now I have another question...lets say that after one ring is fired, I want the rings to fire down instead of out...how do I do it? Using Obj_SetPosition doesn't work because it throws the bullet against the wall because it is perpetually being told to go down...Since I can't reset the angle and speed since it'll change the parameters of the currently existing object bullets to go down, what do I do? Here's what I have that's making due for now, but I'd like to change it to be a little more appealing...

  if(f>1115-delay && f<1165-delay){

Obj_SetAngle(bang,135); Obj_SetSpeed(bang,2);

   }

Suggestions?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #444 on: July 12, 2011, 05:40:02 AM »
...make another object bullet function?

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #445 on: July 12, 2011, 04:34:59 PM »
Woops...I need to think before I speak >.< Thanks!

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #446 on: July 13, 2011, 12:49:58 AM »
Can someone tell me if we can use "global" variable that we can use in all the functions of the script?
Like change the value of a variable in a task and get this new value in another task?
I will post my code if it's not clear enough.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #447 on: July 13, 2011, 04:05:13 AM »
Can someone tell me if we can use "global" variable that we can use in all the functions of the script?
Like change the value of a variable in a task and get this new value in another task?
I will post my code if it's not clear enough.

Uhh... odd question. Here, have a really really crude example:

Code: [Select]
script_enemy_main {
    let script_wide_variable = 0;
    @Initialize {
    }
    @MainLoop {
    }
    @DrawLoop {
    }
    @Finalize {
    }

    function AddNumberToScriptWideVariable(number){
        script_wide_variable += number;
    }
}
Obviously totally pointless, but I hope it got the point across.
<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: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #448 on: July 15, 2011, 10:20:09 PM »
How would you make an object bullet move in a sine wave or cosine wave? Stupid question, sorry >.<

EDIT: I mean an oscillating pattern like the graph of a sine or cosine function...sorry if I confused anyone!
« Last Edit: July 15, 2011, 10:24:02 PM by ByakuganAce »

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #449 on: July 15, 2011, 10:45:38 PM »
not a stupid question really, just difficult if you don't trig well or whatever

firstposx = bulletorigin + speed*cos(angle)
firstposy = bulletorigin + speed*sin(angle)
secondposx = firstposx + wave*cos(angle+90)
speed += bla
wave += sin(bla2)
bla2 += bla3

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