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

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #420 on: October 02, 2010, 01:53:55 AM »
It's funny that you mention that, Azure, since that's just what I discovered myself as well. I followed Helepolis' tutorial on Object Effects and ended up with this.

The Purple Sun of Xereus

Edit: You'll want to watch this in HD and turn it up to fullscreen. Youtube's really massacred the sharpness.

So far it consists of two Add-blended images spinning in opposite directions, and a lower-layered Alpha image to keep the centre free from transparency. I'm sure I could touch it up by adding some irregularity into the motions, but it's looking pretty spiffy already if I may say so myself.

Thanks for your help guys. :)
Looks SECK SEE.
Hitbox of the sun could be smaller though.
Since you could almost stick your entire hitbox graphic into one in SA and the sun's hitbox is even smaller in 10 evil stars :P

Edit: Might spawning the Sun on top of a familiar and then have it keep a track on the enemy's movement every frame and follow it work?
Yes, that would be the easiest way to do it.
Obj_SetPosition(obj,GetX,GetY); every frame
Just a reminder  :3

YummyLychee

Re: Danmakufu Q&A/Problem thread number 4
« Reply #421 on: October 02, 2010, 11:17:41 PM »
So ummm...

For some reason, whenever i kill an enemy on a stage script (the regular way, VanishEnemy, etc) the rest of the on-screen enemies' sprites disappear

And they don't get deleted when they fly off-screen (unless i do something like if(GetX>GetClipMaxX){ VanishEnemy; } ... but then the rest of the enemies that are onscreen turn invisible)



GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #422 on: October 02, 2010, 11:20:20 PM »
So ummm...

For some reason, whenever i kill an enemy on a stage script (the regular way, VanishEnemy, etc) the rest of the on-screen enemies' sprites disappear

And they don't get deleted when they fly off-screen (unless i do something like if(GetX>GetClipMaxX){ VanishEnemy; } ... but then the rest of the enemies that are onscreen turn invisible)



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.

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #423 on: October 03, 2010, 11:02:50 PM »
How would I insert music into a Plural script? Do I have to use a Stage script or something?

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #424 on: October 03, 2010, 11:05:26 PM »
Just play it at the beginning and don't delete/stop the music on Finalize?

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

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #425 on: October 03, 2010, 11:12:35 PM »
So, load and play it from the first nonspell? It doesn't seem to be working.

EDIT: Maybe something's wrong with the music file itself. I tried making a Stage script and used LoadMusic and PlayMusic, but it's still no good.
« Last Edit: October 03, 2010, 11:24:52 PM by KrackoCloud »

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #426 on: October 03, 2010, 11:52:31 PM »
Protip: If music isn't working, it's either
-You didn't load it
-Typo
-It's the music file

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

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #427 on: October 04, 2010, 04:00:55 AM »
Protip: If music isn't working, it's either
-You didn't load it
-Typo
-It's the music file
-It's danmakufu and your computer not agreeing (My Vista doesn't play MP3's or WAV's but sound effects work fine)

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #428 on: October 04, 2010, 04:14:24 AM »
Yeah, I just converted the .mp3 into a .wav and now it works fine.  :/

Re: Danmakufu Q&A/Problem thread number 4
« Reply #429 on: October 04, 2010, 04:43:24 AM »
Sometimes the way the mp3 file is coded, danmakufu might not be able to read it, so usually you should open Audacity or some other music editing program and re-code it. Meaning just save it again using the Music Editing Program

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem thread number 4
« Reply #430 on: October 04, 2010, 04:15:17 PM »
I almost feel ashamed for coming to you with a question like this, but I really can't seem to figure out why it is behaving in this way. It's probably going to be something stupid.

Anyway, I'm simply trying to spawn a bunch of ShotA's randomly across the screen, and have them travel towards the position of the script enemy (not the boss itself). Here's how this simple deal looks like so far...

I hope that it is alright if I post a snippet of my code in here, since it doesn't take up nearly as much room as the entire file would.

Code: [Select]
            CreateShotA(0,rand(GetClipMinX,GetClipMinX+100),rand(GetClipMinY,GetClipMaxY),20);
            wait(1);
            CreateShotA(1,rand(GetClipMaxX-100,GetClipMaxX),rand(GetClipMinY,GetClipMaxY),20);
            wait(1);
            CreateShotA(2,rand(GetClipMinX,GetClipMaxX),rand(GetClipMaxY-100,GetClipMaxY),20);
            wait(1);

            SetShotDataA(0,20,0,GetAngle,0,0.01,1,36);
            SetShotDataA(1,20,0,GetAngle,0,0.01,1,36);
            SetShotDataA(2,20,0,GetAngle,0,0.01,1,36);

            FireShot(0);
            FireShot(1);
            FireShot(2);

The Wiki tells me that the GetAngle function should return the angle towards the script enemy if it is used in the correct script, which it is. But all that's happening is that the bullets travels in a straight line to the right of the screen, regardless of where the script enemy actually is. And to make matters even more weird, if I try GetAngleToPlayer instead, they all just drop directly down as if the angular value was 90, regardless of where I am on the screen.

There must be something else behind this malfunctioning, right?

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #431 on: October 04, 2010, 04:21:24 PM »
GetAngle returns the angular direction of the enemie's movement. What you want is to have a variable each for x and y, set these to random values, and then create a shot with these variables as their positions and the atan2 angle from these coordinates to the position of the enemy.

GetAngleToPlayer returns the angle from the enemy to the player, so that one is right out.  :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."

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #432 on: October 04, 2010, 04:24:11 PM »
GetAngle is the angle that *whatever script you're calling it on* is moving at.

You'll want atan2(bullety-GetY,bulletx-GetX); as long as you're firing these bullets from the enemy script and not the boss. to communicate from boss to enemy I'm pretty sure you need commondata.

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

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem thread number 4
« Reply #433 on: October 04, 2010, 04:45:54 PM »
Using Atan2 is certainly not what I was expecting, but I tried it and it seems to be working just as intended. Thanks for that. :)

And Iryan, of course I already knew in advance that GetAngleToPlayer wouldn't work the way I wanted it to, I was merely testing it to see if it would behave like I expected it to - which it didn't. I was under the assumption that using the angle functions with the bullets would yield the enemy/player angles for the bullets themselves to use, but that's apparently not the case. Something new every day, huh?  :]

Chau

  • Warning! Incoming Engrish post!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #434 on: October 04, 2010, 08:27:15 PM »
Hi.
I wanted to try animated custom bullets. The normal animation works fine, but when the player is hit and the bullets are deleted you can see white lines around the bullets.

http://img201.imageshack.us/img201/5647/danmakufu.png
Er, is this okay when I put the image here as a hyperlink?

I used transparency around the bullets to make sure that there are no spots where the RGB is not 00 00 00.

How do I fix this problem? Or is there something like a "typical newbie mistake"?  ???
 

Re: Danmakufu Q&A/Problem thread number 4
« Reply #435 on: October 04, 2010, 09:02:14 PM »
It looks like the bullet next to it in the shot sheet may be too close, and it's showing up slightly in the graphic rect. You can try condensing the graphic rect by one pixel to avoid that (but it may cut into your image), or move the image next to that bullet in the shot sheet over a bit.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #436 on: October 06, 2010, 02:42:50 AM »
How would one revert player death in stage scripts
Eg: if implementing a custom border system like PCB's
When a player gets hit, how do you revive the player without the player pressing x?
SetPlayerInvincibility?
or save the player's x and y and when OnPlayerMissed is called, ShootDownPlayer; <-prevents deathbombing ExtendPlayer(1); and then once the player revives resume the player's x and y?
What is the best way to do this?

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem thread number 4
« Reply #437 on: October 06, 2010, 04:01:33 AM »
How would one revert player death in stage scripts
Eg: if implementing a custom border system like PCB's
When a player gets hit, how do you revive the player without the player pressing x?
SetPlayerInvincibility?
or save the player's x and y and when OnPlayerMissed is called, ShootDownPlayer; <-prevents deathbombing ExtendPlayer(1); and then once the player revives resume the player's x and y?
What is the best way to do this?

There's a built-in Border funtction; SuperNaturalBorder() to set, and GetTimeOf~ to see the status. If you want custom behavior, you can be sniffing for the three different methods of ending a border (gettime==1 for timing out, bomb key for manual cancel, gettime==0 for collision) each frame. If you want to prevent bullets from clearing on a broken border, you could do something with bomb resistance (though it might get a bit complicated if you don't want them to actually be bomb resistant).

Probably. I haven't used this function myself, so these are just rough ideas.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #438 on: October 06, 2010, 04:46:37 AM »
There's a built-in Border funtction; SuperNaturalBorder() to set, and GetTimeOf~ to see the status. If you want custom behavior, you can be sniffing for the three different methods of ending a border (gettime==1 for timing out, bomb key for manual cancel, gettime==0 for collision) each frame. If you want to prevent bullets from clearing on a broken border, you could do something with bomb resistance (though it might get a bit complicated if you don't want them to actually be bomb resistant).

Probably. I haven't used this function myself, so these are just rough ideas.
Actually I used SuperNaturalBorder before but it kinda sucks so :V

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #439 on: October 06, 2010, 10:05:06 PM »
What would be the best way to:
*Make an enemy shoot revenge bullets when destroyed.
*Transition the background at certain points like midboss, boss, etc. in stages.   I don't know how to go about doing that.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #440 on: October 06, 2010, 11:28:26 PM »
*Make an enemy shoot revenge bullets when destroyed.

This. You just shoot the bullets in @Finalize...

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #441 on: October 07, 2010, 12:37:44 AM »
This. You just shoot the bullets in @Finalize...
Oh crap, I thought it was some special function or something that had to do with If EnemyBeDeleted or something weird. Thanks.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #442 on: October 08, 2010, 11:45:36 PM »
How do you delete the default sound effects again? :derp:

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #443 on: October 09, 2010, 02:50:53 AM »
How do you delete the default sound effects again? :derp:
Uh. DeleteSE("seFapfapfap.wav"); ?
Replace fapfapfap (obvious)
with
Code: [Select]
seSuperNaturalBorder1.wav //activation of SNB
seScore.wav
sePlayerSpellCard.wav //SFX when player uses a SC
sePlayerShot01.wav //SFX for player shot
sePlayerCollision.wav //SFX when player dies
seGraze.wav //SFX for grazing
seGetSpellCardBonus.wav //...
seExplode01.wav
seEnemyExplode01.wav //when you defeat a yosei
seBomb_ReimuB.wav // i think this is obvious
seBomb_ReimuA.wav //so is this
se1UP.wav //Extend! lives
seUseSpellCard.wav //I think it's the one when you call SetScore(score);...
seSuperNaturalBorder2.wav //Maybe when you crush a SNB.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #444 on: October 09, 2010, 02:58:00 AM »
oh I missed the se part. thanks

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #445 on: October 09, 2010, 04:03:12 AM »
Code: [Select]
snip

Wait a sec... Is that from MY reply to the unraveling th_dnh.dat topic? :3

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #446 on: October 09, 2010, 06:27:47 AM »
Wait a sec... Is that from MY reply to the unraveling th_dnh.dat topic? :3
Yes officer. Are you gonna charge me for copyright?  :smug:

Sejha

  • I think Im a game dev. And Musician.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #447 on: October 10, 2010, 01:32:57 AM »
Sooo~ How do I make a Menu a la CtC?
I've evolved a lot. When did I make this account again?

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #449 on: October 10, 2010, 04:44:36 AM »
Yes officer. Are you gonna charge me for copyright?  :smug:

[sarcasm]Yes.[/sarcasm]