Author Topic: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry  (Read 243900 times)

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #120 on: August 13, 2014, 02:40:36 AM »
Out of boredom, I try creating a background that will be shown during spell cards.
However, it didn't show properly as I expected.

Expectation (note that the circle in the center is a separate image, and should rotate clockwise):


Reality (ignore everything except the background):


The code:
http://pastebin.com/h366CABC

The files linked in the code are in the right directory, as shown:

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #121 on: August 13, 2014, 04:22:59 AM »
For one, you don't need to do the things involving id[0] id[1] id[2] id[3] inside the first loop; these would be executed four times for no reason.
You can also use ObjSprite2D_SetSourceRect() and ObjSprite2D_SetDestCenter() instead of manipulating individual vertices (2D sprite objects also automatically have 4 vertices) to make things cleaner and easier.
You can rewrite your first loop as
Code: [Select]
ObjPrim_SetTexture(id[0],csd~"./stg6img/enm6a.png");
ObjPrim_SetTexture(id[1],csd~"./stg6img/enm6a.png");
ObjPrim_SetTexture(id[2],csd~"./stg6img/enm6b.png");
ObjPrim_SetTexture(id[3],csd~"./stg6img/enm6c.png");
ascent(i in 0..4){
                ObjRender_SetPosition(id[i],CenX,CenY,0);
                Obj_SetRenderPriorityI(id[i],22);
                ObjRender_SetBlendType(id[i],BLEND_ALPHA);
                ObjRender_SetScaleXYZ(id[i],1,1,0);
                ObjSprite2D_SetSourceRect(id[i],0,0,384,448);
                ObjSprite2D_SetDestCenter(id[i]);
}
ObjRender_SetScaleXYZ(id[3],1.1,1.1,0);

And really just in general it seems to be a bit disorganized and you have repeating code in a few places. You should look into cleaning it up.

Anyways as for your main problem, I take note that
1) alpha1 and alpha2 are set to 0 and never change, so it's invisible.
2) emn6b is drawn on the same layer as enm6c, but is drawn before it, so regardless it would be drawn underneath everything.

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #122 on: August 13, 2014, 05:35:14 AM »
For one, you don't need to do the things involving id[0] id[1] id[2] id[3] inside the first loop; these would be executed four times for no reason.
You can also use ObjSprite2D_SetSourceRect() and ObjSprite2D_SetDestCenter() instead of manipulating individual vertices (2D sprite objects also automatically have 4 vertices) to make things cleaner and easier.
You can rewrite your first loop as
Code: [Select]
ObjPrim_SetTexture(id[0],csd~"./stg6img/enm6a.png");
ObjPrim_SetTexture(id[1],csd~"./stg6img/enm6a.png");
ObjPrim_SetTexture(id[2],csd~"./stg6img/enm6b.png");
ObjPrim_SetTexture(id[3],csd~"./stg6img/enm6c.png");
ascent(i in 0..4){
                ObjRender_SetPosition(id[i],CenX,CenY,0);
                Obj_SetRenderPriorityI(id[i],22);
                ObjRender_SetBlendType(id[i],BLEND_ALPHA);
                ObjRender_SetScaleXYZ(id[i],1,1,0);
                ObjSprite2D_SetSourceRect(id[i],0,0,384,448);
                ObjSprite2D_SetDestCenter(id[i]);
}
ObjRender_SetScaleXYZ(id[3],1.1,1.1,0);

And really just in general it seems to be a bit disorganized and you have repeating code in a few places. You should look into cleaning it up.

Anyways as for your main problem, I take note that
1) alpha1 and alpha2 are set to 0 and never change, so it's invisible.
2) emn6b is drawn on the same layer as enm6c, but is drawn before it, so regardless it would be drawn underneath everything.

I redid the first loop, switched the order of the RenderPriority part, and fixed the zero-alpha part, but nothing has changed.

Pastebin:
http://pastebin.com/ZwD3Lutk

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #123 on: August 13, 2014, 06:23:08 AM »
It looks like you put the draw layer change after the enemy object is deleted and the flag is hit, whatever it is. Put it before, since I assume that while loop is what runs for most of the time.

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

Fumi

  • Dragon of Seven Colors
  • Disaster in Takamagahara
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #124 on: August 16, 2014, 03:13:35 AM »
I got a problem with ascent loops, for what I saw, anything created in an ascent loop can only be referenced inside the same loop which brings a problem when I try to make for example a ring of bullets that will create bullets at the border of the screen.

Code: [Select]
task ay()
{
let bulletX = ObjMove_GetX(objEnemy);
let bulletY = ObjMove_GetY(objEnemy);

let density = 16;
let a = 0;

ascent(i in 0..density)
{

let bulletObj=CreateShotA1(bulletX, bulletY, 2,a,375, 10);

a += 360/density;
ObjMove_AddPatternA1(bulletObj,20,2,a-30-ang);
ObjMove_AddPatternA3(bulletObj,40,2,a+30-ang,NO_CHANGE,0,2,379);
ObjMove_AddPatternA1(bulletObj,60,2,a-30-ang);
ObjMove_AddPatternA3(bulletObj,80,2,a+30-ang,NO_CHANGE,0,2,376);
ObjMove_AddPatternA1(bulletObj,100,2,a-30-ang);
ObjMove_AddPatternA3(bulletObj,120,2,a+30-ang,NO_CHANGE,0,2,376);
ObjMove_AddPatternA1(bulletObj,140,2,a-30-ang);
ObjMove_AddPatternA3(bulletObj,160,2,a+30-ang,NO_CHANGE,0,2,378);
ObjMove_AddPatternA1(bulletObj,180,2,a-30-ang);
ObjMove_AddPatternA3(bulletObj,200,2,a+30-ang,NO_CHANGE,0,2,380);
while(!Obj_IsDeleted(bulletObj)){
if (ObjMove_GetX(bulletObj)<=GetStgFrameLeft+2 && ObjMove_GetX(bulletObj)>=GetStgFrameLeft-2){
CreateShotA1(ObjMove_GetX(bulletObj), ObjMove_GetY(bulletObj), 2,rand(-45,45),375, 10);
}
if (ObjMove_GetX(bulletObj)>=GetStgFrameWidth-2 && ObjMove_GetX(bulletObj)<=GetStgFrameWidth+2){
CreateShotA1(ObjMove_GetX(bulletObj), ObjMove_GetY(bulletObj), 2,rand(135,225),375, 10);
}
if (ObjMove_GetY(bulletObj)<=GetStgFrameTop+2 && ObjMove_GetY(bulletObj)>=GetStgFrameTop-2){
CreateShotA1(ObjMove_GetX(bulletObj), ObjMove_GetY(bulletObj), 2,rand(135,45),375, 10);
}
yield;
}

}



}

This is part of what I'm using the loop, but as you see I need to check every frame if the bullet is touching the border of the screen. However adding a while makes the whole ascent loop to just execute once. How can I make it loop the required number of times? Or how can I make the task check every frame if the bullet is touching the border?

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #125 on: August 16, 2014, 03:37:37 AM »
Just move the whole while loop into a task, and instead call the task with bulletObj as the argument. This way the task will be run for each bullet, and yielding there will yield the new task instead of ay(), allowing ay() to continue.

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #126 on: August 16, 2014, 02:21:55 PM »
I want to make a spell have a random behavior, but be the same every time you play it.
For example:
Code: [Select]
while (!Obj_IsDeleted(bossId))
{
    SetSeed(4); // No such function :c
    let angle = rand(0, 360);
    CreateShotA1(ObjMove_GetX(bossId), ObjMove_GetY(bossId),
   5, // Speed
   angle,
   DS_BALL_L_WHITE,
   10); // Delay
    WaitSeconds(0.1);
}

I couldn't find any function for setting the seed manually.
So, what is the easiest way to achieve this?

PhantomSong

  • The Ghost Living through Everyday Life.
  • Eh, it doesn't matter.
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #127 on: August 16, 2014, 06:14:00 PM »
I want to make a spell have a random behavior, but be the same every time you play it.
For example:
Code: [Select]
while (!Obj_IsDeleted(bossId))
{
    SetSeed(4); // No such function :c
    let angle = rand(0, 360);
    CreateShotA1(ObjMove_GetX(bossId), ObjMove_GetY(bossId),
   5, // Speed
   angle,
   DS_BALL_L_WHITE,
   10); // Delay
    WaitSeconds(0.1);
}

OK, first please dont space out your shot code like that.
Keep is simple like //CreateShotA1(x,y,speed,angle,graphic,delay); before or in the task, or write it down on notepad.

Next you arent resetting angle, so it is picking a random direction and it'll keep that value until you reset it.
Put
angle=rand(0,360); after WaitSeconds

You could also alternatively put rand(0,360) where angle would go.
« Last Edit: August 16, 2014, 06:24:29 PM by PhantomSong »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #128 on: August 16, 2014, 07:20:33 PM »
You are wrong about the angle not being reset, and you didn't even refer to my problem  :wat:
(btw, this is an example I'd just made up, not an actual code from my game. So don't nitpick)

PhantomSong

  • The Ghost Living through Everyday Life.
  • Eh, it doesn't matter.
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #129 on: August 16, 2014, 07:31:22 PM »
You are wrong about the angle not being reset, and you didn't even refer to my problem  :wat:
(btw, this is an example I'd just made up, not an actual code from my game. So don't nitpick)
Oh, I see. SetSeed is what you're referring to. Apologies, i had just got up,

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #130 on: August 16, 2014, 11:31:35 PM »
You cannot set the seed manually, no. If you're expecting random-like behaviour, you could use a sine wave with high frequency or something else to generate patterns that "seem" random, although this doesn't necessarily cluster values like you might expect from a good random number generator, so it depends what you're really going for. You could also implement your own hash function, as a "random number generator" sufficient for bullet patterns doesn't have to be cryptographically strong whatsoever.
« Last Edit: August 16, 2014, 11:34:02 PM by Drake »

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

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #131 on: August 17, 2014, 07:41:39 AM »
Not sure whether this question belongs in this thread, but does anyone know if there's a non-video tutorial for ph3?
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #132 on: August 17, 2014, 11:12:38 AM »
I'm currently writing a rather extensive beginner tutorial. Stay tuned, hopefully I'll be done within the week.

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #133 on: August 20, 2014, 09:17:10 PM »
I've just found out that I can change the resolution in the def file, and then set the game frame with with SetStgFrame.
I thought that maybe I should change everything in my game to relative locations, so I could support multiple resolutions. But it's too much work because of the shot data...

I'm just wondering, do you program to 640*480 or other resolutions?

CK Crash

  • boozer
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #134 on: August 21, 2014, 02:16:46 AM »
There's not really a way that you can scale a game to multiple resolutions while maintaining replay compatibility. Even if you perfectly scale your game to twice the size, there would probably be small difference in collision detection that make it a bad idea. If you use the default 640x480 size, Danmakufu's config allows the user to scale the game up (albeit rather jaggedly). If you want to use a higher resolution, bear in mind that you can't scale it down for users with old monitors.

Scaled render targets of the entire screen might work? I wouldn't worry about it though.
« Last Edit: August 21, 2014, 02:18:18 AM by CK Crash »

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #135 on: September 15, 2014, 09:36:56 PM »
I'm currently writing a rather extensive beginner tutorial. Stay tuned, hopefully I'll be done within the week.

Any progress on that?
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #136 on: September 16, 2014, 12:14:39 AM »
Any progress on that?

Don't press it too much. Tutorials take a lot of time to write, and require a lot of revision to be helpful.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #137 on: September 16, 2014, 12:37:05 AM »
Yeah it's coming along, but obviously it's taking longer than anticipated. This is mostly because of how rigorous I'm being with my writing and phrasing. Sorry for the wait.

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #138 on: September 16, 2014, 02:05:55 AM »
P.S. Earlier today I went to my transition guide and briefly stated that I will not be filling in sections on players and backgrounds. Just a note. I don't fully understand either to the level that I'd need to write it.

Conarnar

  • reeeeeeeeeeeeeeeeeee
  • aaaaaaaaaaaaaaaaaaa
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #139 on: September 27, 2014, 05:33:00 PM »
I don't understand what 敵ライフを適切に返していません。 means.
Edit: nvm, I found out.
« Last Edit: September 28, 2014, 01:34:52 AM by Conarnar »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #140 on: October 04, 2014, 07:55:40 PM »
so... i'm not sure if i should ask this on this thread or what but i guess this belongs here:
regarding ph3 player scripting, is there some place that describes how to make a Player Script or someone who knows how to do so? for the thing i've seen there's nothing on these forums tutorials (regarding the player scripting matter of course), nor did my research on the threads come to a reliable result (or at least for the thing i could see)...
do tell me if this question is out of place please  :V

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #141 on: October 04, 2014, 08:01:43 PM »
so... i'm not sure if i should ask this on this thread or what but i guess this belongs here:
regarding ph3 player scripting, is there some place that describes how to make a Player Script or someone who knows how to do so? for the thing i've seen there's nothing on these forums tutorials (regarding the player scripting matter of course), nor did my research on the threads come to a reliable result (or at least for the thing i could see)...
do tell me if this question is out of place please  :V

There is currently no ph3 player script tutorial. Most people made their scripts by editing one of GTbot's or the Random Player Generator, the former of which was likewise based off of the latter.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #142 on: October 04, 2014, 08:04:32 PM »
oh well, i guess i'll just have to do the exact same thing :v thanks

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #143 on: October 04, 2014, 11:33:52 PM »
oh well, i guess i'll just have to do the exact same thing :v thanks

If you're going to release the player, make sure you cite who made it. Also, you are REQUIRED to have some of the @Event cases or danmakufu may crash when the events are triggered.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #144 on: October 04, 2014, 11:40:15 PM »
i just looked up one and it's a complete freaking mess of coding which i cannot understand... yet, so i'm not going to do anything... yet  :V

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #145 on: October 06, 2014, 07:07:00 PM »
I've been trying to get back into making my IN phantasm stage, and I'm trying to eliminate lag. So, could anyone suggest a less resource-intensive way to make the familiars? I only ever get lag when they're present, and I know that I suck at making them. The attached folder contains everything pertaining to the stage this time, so I won't have to make 3 posts for one problem.  :V
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #146 on: October 06, 2014, 07:25:46 PM »
Why are you loading and trying to replay the music every frame.

Code: [Select]
@MainLoop {
LUNATIC_BLUE;
yield;
}

Code: [Select]
task LUNATIC_BLUE(){
let BGMobj = ObjSound_Create;
let BGMmp3 = GetCurrentScriptDirectory ~ "BGM.ogg";

ObjSound_Load(BGMobj,BGMmp3);
ObjSound_SetSoundDivision(BGMobj,SOUND_BGM);
ObjSound_SetVolumeRate(BGMobj,100);
ObjSound_SetLoopEnable(BGMobj,true);
ObjSound_SetLoopTime(BGMobj,0,284);
ObjSound_SetFade(BGMobj,60);

ObjSound_Play(BGMobj);
}

Use the debug window. If there are 600 instances of a music file, then you know what to fix.

ADDITIONAL NOTES:
Code: [Select]
wait(60);//Assuming that compiling with finish in about a second.Why are you doing this? This does not help you because the stage itself pauses until the thing is loaded.

fairy_fn.txt
Code: [Select]
let shot = ObjShot_Create(OBJ_SHOT);
ObjShot_Regist(shot);
ObjMove_SetPosition(shot,getX(fam)+rand(-30,30),getY(fam)+rand(-30,30));
ObjMove_SetSpeed(shot,0);
ObjMove_SetAngle(shot,angle);
ObjShot_SetGraphic(shot,76);
ObjShot_SetDelay(shot,3);
Please just use
Code: [Select]
let shot = CreateShotA2(getX(fam)+rand(-30,30),getY(fam)+rand(-30,30), 0, angle, 0, 0, 76, 3); and then do your other edits.
« Last Edit: October 06, 2014, 07:31:32 PM by Sparen »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #147 on: October 06, 2014, 08:14:53 PM »
 :V :V :V Thanks! I kinda made a lot of this while tired off my ass, so I made tons of unnecessary objects that I never fixed because of experimentation.
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #148 on: October 06, 2014, 09:36:50 PM »
I am having some problem with shot data (nothing happens..... literally, nothing). Is there a trick to loading or editing them?

I find that if I open and save the included Default_Player_RumiaShotData.txt (no changes, just open & save to disk) it stops working (ie can't shoot anymore, like if the file was being ignored completely). I figure maybe there is some kind of quirk with encoding? But then, what's weird is, if I open and save Default_Player_Rumia.txt in my text editor it works just fine so I really don't know what is happening. Is the encoding of shotdata different than player/stage/etc. scripts? (I am saving as ANSI, tried UTF-8 and a few others too.... pretty sure this shouldn't be an issue though). Even if I create a new file from scratch it still won't load.

Example...
Code: [Select]
#UserShotData

shot_image = "./Player_Shots.png"

ShotData{ id=1 rect=(1, 1,31,31) render=ADD alpha=64 collision=16 }
ShotData{ id=2 rect=(1,32,48,80) render=ADD alpha=64 collision=24 }
(And I load it in my player script's @Initialize via LoadPlayerShotData(current ~ "Player_ShotData.txt");)

This does not work. And Player_shots.png is present, I triple-checked. =) Anyway it is the default "Default_Player_RumiaShot.png" file. This is very frustrating because it looks like it should be working, but it isn't and danmakufu is not giving any information I can post here or use to understand the problem..... It just "doesn't do anything"..... =/

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #149 on: October 06, 2014, 10:11:18 PM »
you didn't forget the ";" at the end of "LoadPlayerShotData(current ~ "Player_ShotData.txt"" right?