Author Topic: Danmakufu Q&A/Problem Thread II  (Read 181118 times)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #750 on: December 30, 2009, 09:22:34 PM »
Config.exe is pissing me off. No matter what type of compatiblity I use or any setting in Applocal, it refuses to show up. Though it is visible inside taskmanager as a running task.

What the hell, I want to adjust options so dnh runs smoother on my laptop. Currently the fps is like 30-40 =.=

Tip from Gamecubic:

Run it as win2k without Applocal. Result => it works. Hooray.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread II
« Reply #751 on: December 30, 2009, 09:38:33 PM »
Guys, I'm trying to make some stuff with object bullets:


It goes like this: The enemy shoots familiars that have all sorts of shapes on them. The shapes rotate and grow over time and bounce with their core around the screen a few times before vanishing offscreen.
So far I managed to make this with a circle. But making anything else I want (triangles, squares, stars, two triangles on top of each other, etc), is breaking my mind!
I couldn't get further than making a framework with a bullet for each edge, but the lining in between those points is giving me a headache.
I tried using Pythagoras' nice equation, but combining that with the motion and rotation of the shapes just won't work.

Can you help me with this? I'm probably doing it completely wrong if I get two pages of text just to make 1 star... >_>;
« Last Edit: December 30, 2009, 09:42:21 PM by puremrz »
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread II
« Reply #752 on: December 30, 2009, 09:47:04 PM »
So you're making the familiars out of bullets? That's what I'm seeing from your screenshot. Or are you making object effects with vertices?

Also, post code.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread II
« Reply #753 on: December 30, 2009, 09:54:29 PM »
I'm making invisible familiars that only act as the center of the shapes and keep them together.
This is the script for those familiars. The rest of the script is only a summon of the familiars.

Code: [Select]
#TouhouDanmakufu
#Title[Tomoko Familiar 1]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let shot1=0;
let bullet1=[];
let angle=0;
let bounce=0;
let radius=0;
let speed=1;
let bullets=15;
let rotatespeed=0;
let random=rand_int(0,1);
if(random==0){ rotatespeed=0.3; }
if(random==1){ rotatespeed=-0.3; }

let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

@Initialize{
SetLife(1);
MagicCircle(false);
SetAngle(rand(0,360));
SetSpeed(speed);
}

@MainLoop{

if(time==0){
let color=rand_int(61,70);
loop(bullets){
shot1=(Obj_Create(OBJ_SHOT));
Obj_SetPosition(shot1,GetX+radius*cos(angle),GetY+radius*sin(angle));
Obj_SetAngle(shot1,angle+360/20);
Obj_SetAutoDelete(shot1,false);
ObjShot_SetBombResist(shot1,true);
ObjShot_SetGraphic(shot1,color);
angle+=360/bullets;
bullet1=bullet1~[shot1];
}
}

let i=0;
while (i<length(bullet1)){
Obj_SetPosition(bullet1[i],GetX+radius*cos(angle),GetY+radius*sin(angle));
Obj_SetAngle(bullet1[i],angle+360/bullets);
angle+=360/bullets;
i++;
}
angle+=rotatespeed;


if(bounce<3){
if(GetX<=minx){ SetAngle(180-GetAngle); SetX(GetX+1); SetSpeed(speed); bounce+=1; }
if(GetX>=maxx){ SetAngle(180-GetAngle); SetX(GetX-1); SetSpeed(speed); bounce+=1; }
if(GetY<=miny){ SetAngle(-GetAngle); SetY(GetY+1); SetSpeed(speed); bounce+=1; }
if(GetY>=maxy){ SetAngle(-GetAngle); SetY(GetY-1); SetSpeed(speed); bounce+=1; }
}

if(GetX<=minx-300 || GetX>=maxx+300 || GetY<=miny-300 || GetY>=maxy+300){
let i=0;
while (i<length(bullet1)){
Obj_Delete(bullet1[i]);
i++
}
VanishEnemy;
}

if(radius<150){ radius+=0.2; }

time++;
frame++;

}

@DrawLoop{
}

@Finalize{
}

}

Yeah, no tasks.  8)
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: Danmakufu Q&A/Problem Thread II
« Reply #754 on: December 31, 2009, 12:59:51 AM »
Guys, I'm trying to make some stuff with object bullets:

It goes like this: The enemy shoots familiars that have all sorts of shapes on them. The shapes rotate and grow over time and bounce with their core around the screen a few times before vanishing offscreen.
So far I managed to make this with a circle. But making anything else I want (triangles, squares, stars, two triangles on top of each other, etc), is breaking my mind!
I couldn't get further than making a framework with a bullet for each edge, but the lining in between those points is giving me a headache.
I tried using Pythagoras' nice equation, but combining that with the motion and rotation of the shapes just won't work.

Can you help me with this? I'm probably doing it completely wrong if I get two pages of text just to make 1 star... >_>;

If you need to create a line of bullets between two points, you just need to interpolate between the two points.  Use something like the following pseudocode:

Code: (pseudocode ... not real code) [Select]
let number_of_bullets = 9; // Number of bullets on the line

// First point
let x1 = first_x_position;
let y1 = first_y_position;

// Second point
let x2 = second_x_position;
let y2 = second_y_position;

// Loop counter from 0 to number_of_bullets (count up by 1 each time)
for (counter = 0 to number_of_bullets)
{
   let position_fraction = counter / number_of_bullets;

   // calculate next bullet's position
   let x = (x1 * position_fraction) + (x2 * (1 - position_fraction));
   let y = (y1 * position_fraction) + (y2 * (1 - position_fraction));

   // create the next bullet
   Create_Bullet(x, y, ...);
}

(remember, this isn't actual code/script ... it's just a quick pseudo-code to give you the idea)

This'll create number_of_bullets on a line between (x1, y1) and (x2, y2), including the endpoints.  To exclude the endpoints, start counter at 1 and go up to nmber_of_bullets-1 instead.



Yeah, no tasks.  8)

HELL YEAH! :dragonforce:
to quote Naut:
"I can see the background, there are too many safespots."
:V

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #755 on: December 31, 2009, 07:57:56 AM »
Following up on NC's post, after you make the bullets, you still want to rotate them around the invisible familiar right? To do that, you'll need to figure out what the angle is from the familiar to the bullet and the distance. Since the bullets are objects, you have Obj_GetX, and Obj_GetY to help you with the calculations.

Angle can be found with let angle = atan2(y2-y1, x2-x1);
Distance can be found with let distance = ((x2-x1)^2+(y2-y1)^2)^0.5;
<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.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #756 on: December 31, 2009, 03:05:39 PM »
Ok, so i"ve made this spellcard and stuff.

So when I tried it out this, it crashes.
Code: (Bleh. it just crashes, no script error or anything.) [Select]
#TouhouDanmakufu[Stage]
#Title[I don't know why it's crashing.]
#Text[It just crashes.]
//Background[IceMountain]
#PlayLevel[Wut]
#BGM[]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

 let GCSD = GetCurrentScriptDirectory;
 function Wait(let frames){
   loop(frames){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }
 function WaitForNoEvent {
  while(OnEvent) { yield; }
 }
 task stage6 {
  Wait(1);
  CreateEnemyBossFromFile(GCSD~"theattack.txt", GetCenterX, GetClipMinY-50, 0, 0, 0);
  Wait(360);
  Clear;
 }

 @Initialize{
  stage6;
  LoadGraphic(EFamiliar);
 }
 @MainLoop{
  yield;
 }
 let EFamiliar = GCSD~"img\enemy_option.png";
 let rotateoptioncircle = 0; let rotateoptioncirclea = 0;
 @Background{
  rotateoptioncircle -= rotateoptioncirclea; rotateoptioncirclea+=1/4;
  if(rotateoptioncircle >= 360) { rotateoptioncircle -= 360; } if(rotateoptioncirclea >= 360) { rotateoptioncirclea -= 360; }
  SetTexture(EFamiliar);
  SetGraphicRect(0,0,75,75);
  SetGraphicAngle(0, 0, rotateoptioncircle);
  SetGraphicScale(5, 5);
  SetRenderState(ALPHA);
  SetAlpha(255);
  SetColor(255, 255, 255);
  DrawGraphic(GetCenterX, GetCenterY);
 }
 @Finalize{
  LoadGraphic(EFamiliar);
 }
}

Code: (theattack.txt) [Select]
#TouhouDanmakufu
#Title[Works here, though.]
#Text[]
#Image[]
#BackGround[IceMountain]
#Player[FREE]
#ScriptVersion[2]

//Don't worry about having the images.
script_enemy_main {
    let BossImage = "script\img\ExRumia.png";
    let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
    let CutInGraphic = GetCurrentScriptDirectory~"img\cut.png";
    let bossname = "????????? ?? ?????";
    let Spell = 1;
    let SpellName = "「???」";
@Initialize {
SetLife(500000); SetDamageRate(0, 0); SetTimer(68);
SetEnemyMarker(true); MagicCircle(true); SetInvincibility(180);
LoadGraphic(BossImage); LoadGraphic(EFamiliar);
TMain;
SetInvincibility(480);
SetEffectForZeroLife(60, 55, 3); //LastSpell;
SetShotAutoDeleteClip(10, 10, 10, 10);
}

@MainLoop {
if(GetTimer > 0) { SetLife(630); }
SetCommonData("StuffLife", GetEnemyLife);
SetCommonData("StuffTime", GetTimer);
if(Spell <= 1) {
if(show) { ascent(i in 0..7) { SetCollisionA(GetPlayerX+50*cos(i*360/7), GetPlayerY+50*sin(i*360/7), 10); } }
}
yield;
}

let animation = 0;
let rotate = 0; let rotatea = 0;
let alpha = 0;
let x = 0;
let count = 0;
let show = 0;
@DrawLoop {
if(!show){
if(count<270) {
count++;
if(x<=20) { x+=1/6; }
if(alpha < 255) { alpha+=255/120; }
if(count==210) { alpha=255; } if(count>210) { x+=1/4; alpha-=255/60; }
SetFontColor(255, 255, 255, 0, 0, 155);
DrawText("Blue text! THIS IS A COPY", GetCenterX-100+x, GetCenterY+150-10, 15, alpha);
SetFontColor(255, 255, 255, 155, 0, 155);
DrawText("Purple text! OF YUYUKO", GetCenterX-100-x, GetCenterY+150+10, 10, alpha);
}
}
SetFontColor(255, 255, 255, 0, 0, 155);
DrawText(bossname, 40, 36, 12, 255);
}

@Finalize {
PlaySE("se\se_enep01.wav");
DeleteCommonData("StuffLife");
DeleteCommonData("StuffTime");
SetShotAutoDeleteClip(200, 200, 200, 200);
SetShotColor(255, 255, 255);
DeleteGraphic(BossImage); DeleteGraphic(EFamiliar);
}

task TMain {
suika;
SetMovePosition02(GetCenterX, GetCenterY, 1);
loop(120){yield;}
loop(4) { Concentration02(45); PlaySE("se\se_ch00.wav"); loop(30){yield;} } Concentration02(90); PlaySE("se\se_ch00.wav"); loop(45){yield;}
show = 1;
SetText(SpellName); SetScore(10000000); //SetDurableSpellCard;
loop(30) { yield; }
loop(150) { yield; }
PlaySE("se\se_option.wav"); ascent(i in 0..6) { CreateEnemyFromScript("one", GetX, GetY, 0, 0, i*360/6); }
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>50) { yield; } attack1;
while(GetCommonData("StuffLife")>300 && GetCommonData("StuffTime")>40) { yield; } SetDamageRate(9, 3); attack2;
}
task suika {
task CreateShotR(x, y, delay) {
let obj = Obj_Create(OBJ_SHOT); let c = -delay;
Obj_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, BLUE05);
ObjShot_SetDelay(obj, delay);
ObjShot_SetBombResist(obj, 1);
Obj_SetCollisionToPlayer(obj, 0);
while(!Obj_BeDeleted(obj)) {
Obj_SetY(obj, Obj_GetY(obj)-2);
c++; if(c==0) { Obj_Delete(obj); }
yield;
}
}
loop {
loop(10) { CreateShotR(GetX+rand(-15, 15), GetY+rand(-10, 30), rand_int(15, 25)); }
loop(5) { yield; }
}
}
task attack1 {
let graphic = [BLUE03, BLUE02, BLUE01, BLUE04, BLUE05];
let num = 3; let a = GetAngleToPlayer;
loop {
a = GetAngleToPlayer;
ascent(i in 0..num) {
PlaySE("se\se_lazer01.wav");
CreateShot01(GetX, GetY, 5, a+i*360/num, graphic[0], 10);
loop(30) { CreateShot01(GetX, GetY, rand(4, 5), a+i*360/num+rand(-2, 2), graphic[1], 10); }
loop(60) { CreateShot01(GetX, GetY, rand(3, 5), a+i*360/num+rand(-3, 3), graphic[2], 10); }
loop(25) { CreateShot01(GetX, GetY, rand(1, 5), a+i*360/num+rand(-3, 3), graphic[3], 10); }
loop(70) { CreateShot01(GetX, GetY, rand(1, 5), a+i*360/num+rand(-7, 7), graphic[4], 10); }
}
loop(60) { yield; }
}
}
task attack2 {
loop {
ascent(i in -17..18) { ascent(j in 0..6) { CreateShot01(GetX, GetY, 1/3, GetAngleToPlayer+i*1+j*360/6, RED02, 0); PlaySE("se\se_tan02.wav"); } }
loop(180) { yield; }
}
}
}

script_enemy one {
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
@Initialize {
SetLife(9999);
TMain;
//LoadGraphic(EFamiliar);
}

@MainLoop {
SetLife(9999);
SetMovePosition02(GetCenterX+radius*cos(a), GetCenterY+radius*sin(a), 1);
yield;
}

let rotate = 0;
@DrawLoop {
rotate += 7; if(rotate >= 360) { rotate -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotate);
SetGraphicScale(1, 1);
SetRenderState(ADD);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetX, GetY);
}

@Finalize {
SetShotColor(255, 255, 255);
//DeleteGraphic(EFamiliar);
}

let radius = 0; let a = GetArgumentDefault(0); let delay = 3;
task TMain {
radiusinc;
ainc;
unr;
atak1;
while(GetCommonData("StuffLife")>100 && GetCommonData("StuffTime")>10) { yield; }
PlaySE("se\se_option.wav"); CreateEnemyFromScript("two", GetPlayerX, GetPlayerY, 0, 0, GetArgument);
}
task radiusinc {
while(radius<225) {
radius+=2;
yield;
}
loop {
CreateShot01(GetX, GetY, 4, a, BLUE22, 0); PlaySE("se\se_kira01.wav");
loop(delay) { yield; }
}
}
let spin = 0.75;
task ainc {
loop {
a+=spin; if(a>=360) { a-=360; }
yield;
}
}
task unr {
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>30) { yield; }
while(radius > 150) { radius-=1/4; yield; }
spin = 5.5; delay = 1;
}
task atak1 {
while(GetCommonData("StuffLife")>200 && GetCommonData("StuffTime")>20) { yield; }
loop {
CreateShot01(GetX, GetY, 2, GetAngleToPlayer, RED03, 0); PlaySE("se\se_tan02.wav");
loop(240) { yield; }
}
}
}

script_enemy two {
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
@Initialize {
SetLife(9999);
TMain;
//LoadGraphic(EFamiliar);
}

@MainLoop {
SetLife(9999);
SetMovePosition02(GetPlayerX+radius*cos(a), GetPlayerY+radius*sin(a), 1);
yield;
}

let rotate = 0;
@DrawLoop {
rotate += 7; if(rotate >= 360) { rotate -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotate);
SetGraphicScale(1, 1);
SetRenderState(SUBTRACT);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetX, GetY);
}

@Finalize {
SetShotColor(255, 255, 255);
//DeleteGraphic(EFamiliar);
}

let radius = 0; let a = GetArgumentDefault(0);
task TMain {
ainc;
unr;
}
let spin = 5.5;
task ainc {
loop {
a-=spin; if(a>=360) { a-=360; }
yield;
}
}
task unr {
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>20) { yield; }
while(radius < 100) { radius+=1; yield; }
atak1;
}
task atak1 {
while(GetCommonData("StuffLife")>100 && GetCommonData("StuffTime")>20) { yield; }
loop {
ascent(i in -5..6) { CreateShot01(GetX, GetY, 3/4, a+i*30, RED22, 0); } PlaySE("se\se_tan02.wav");
loop(240) { yield; }
}
}
}
Does it have to do with the familiars spawning familiars?

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread II
« Reply #757 on: December 31, 2009, 04:46:29 PM »
Thanks for the help guys.
There was still one thing missing, but I figured that out on my own somehow :V



With this framework, I can easily make squares and other shapes too. Yay!
« Last Edit: December 31, 2009, 08:41:54 PM by puremrz »
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Re: Danmakufu Q&A/Problem Thread II
« Reply #758 on: January 01, 2010, 12:09:06 PM »
Ahh, you were close.

DrawText("History: " ~ caprate ~ "/" ~ seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);

Use tilde to combine strings.
DrawText("Seconds:" ~ frame/60 ~ "frame" ~ time, GetClipMinX,GetClipMinY+60,20,255);
I do not see what I am doing wrong...
I get an error at this message, its in my post at the Error Message Thread

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread II
« Reply #759 on: January 01, 2010, 02:13:58 PM »
DrawText("Seconds:" ~ frame/60 ~ "frame" ~ time, GetClipMinX,GetClipMinY+60,20,255);
I do not see what I am doing wrong...
I get an error at this message, its in my post at the Error Message Thread

if the variables frame and time are values, you should use ToString(frame/60) and ToString(time) I think...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Re: Danmakufu Q&A/Problem Thread II
« Reply #760 on: January 02, 2010, 09:00:11 AM »
Ummm hello ^^...I've been reading these forums for quite a while and, finally, i decided to make an account *yay*

I have already dabbled a bit with danmakufu by reading the tutorials, and even downloaded some of the stuff you guys make (really nice btw!)

However, some of the scripts i try to run require CtC bullets. I tried to get the bullets from the forums and from the game itself, but i couldn't find them.

So...i guess my question is: can someone explain to me how to get the CtC bullets? (lolnubquestion) i don't even know if people are allowed to ask for the bullets, so sorry if it is >.<

Also, thanks in advance~
« Last Edit: January 02, 2010, 09:07:14 AM by durdur »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #761 on: January 02, 2010, 09:05:38 AM »
So...i guess my question is: can someone explain to me how to get the CtC bullets? (lolnubquestion) i don't even know if people are allowed to ask for them, so sorry if it is >.<

Also, thanks in advance~

Welcome to the forum. And I can understand your question because Stuffman forgot to link the CtC bullets to the FAQ/resource thread. I'll notify him.

You are obviously looking for this: http://www.shrinemaiden.org/forum/index.php?topic=369.0 Download it and place it in your root of danmakufu. That should be working out.


Re: Danmakufu Q&A/Problem Thread II
« Reply #762 on: January 02, 2010, 09:12:13 AM »
thanks Hele ^^

Hmm i did find that post somewhere but didn't pay attention to it because of the 0 reply count...oh well  :P

Didn't expect such a quick reply... thanks for that too!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #763 on: January 02, 2010, 03:20:25 PM »
I am going to spare you the details how much I fail in math ( oh wait, I already said it ).

Iryan once helped me out with a code to create a fountain effect effect for my afro boss. But now I need the similar type of code again, except I want to bullets to halt for a while etc. CreateShotA would help out, but it is not. SetShotData_XY cannot use NULL for the X-speed, Y-speed, X-acc and Y-acc. Also even if I do this:

CreateShotA(1,GetEnemyX,GetEnemyY,10);   
SetShotDataA_XY(1,0,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01);   <--- fountain
SetShotDataA(1,60,0,NULL,0,0,0,RED01);    <--- halt + maintain angle
SetShotDataA_XY(1,90,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01); <---- FFF cannot maintain angles here cause you cannot store it. Also this makes bullets 'rejump' making it look bad.

Thus Naut adviced me to use Object Bullets because you can get angle to perform calculation. Though yea, he he he--- How? Can someone explain me a bit step by step how create an arching Object Bullet:


Aside the chunk of code I kind of hope to understand a bit what is going on. So bit detailed explanation ( if not much asked ) is welcome.

Thaws

  • _m廿廿m_
Re: Danmakufu Q&A/Problem Thread II
« Reply #764 on: January 02, 2010, 04:11:31 PM »
CreateShotA(1,GetEnemyX,GetEnemyY,10);   
SetShotDataA_XY(1,0,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01);   <--- fountain
SetShotDataA(1,60,0,NULL,0,0,0,RED01);    <--- halt + maintain angle
SetShotDataA_XY(1,90,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01); <---- FFF cannot maintain angles here cause you cannot store it. Also this makes bullets 'rejump' making it look bad.

Thus Naut adviced me to use Object Bullets because you can get angle to perform calculation. Though yea, he he he--- How? Can someone explain me a bit step by step how create an arching Object Bullet:


I think it'd be easier to just use a task for each object bullet.
Code: [Select]
task whatever
{
let ac = *y-acceleration*;
let xv = 5*cos(rand(240,270));
let yv = 5*sin(rand(240,270)); //x,y velocity

let obj=Obj_Create(OBJ_SHOT);
//set you object angle/speed/graphic to whatever


loop(*frames you want the bullet to move for before halting*)
{
//The first thing to do is to relocate the bullet according to its velocity
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
//Then you change the y-velocity according to the acceleration
yv += ac;
yield;
}

loop(*Length of frames the bullet halts*)
{yield;}

//Then just let the bullet fall until it is deleted
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}


Didn't test this, I hope I'm understanding what you want to do and it works.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #765 on: January 02, 2010, 04:37:48 PM »
Iryan once helped me out with a code to create a fountain effect effect for my afro boss.
Hi there.  :V

Code: [Select]
task whatever{
let flyangle=rand(240,270);
let ac = *y-acceleration*;
let xv = 5*cos(flyangle);
let yv = 5*sin(flyangle); //x,y velocity

let obj=Obj_Create(OBJ_SHOT);

//set you object angle/graphic to whatever, but the speed to zero

loop(*frames you want the bullet to move for before halting*) {

//The first thing to do is to relocate the bullet according to its velocity

Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);

//Then you change the y-velocity according to the acceleration

yv += ac;

yield;
}

loop(*Length of frames the bullet halts*) {yield;}

//Then just let the bullet fall until it is deleted

while(!Obj_BeDeleted(obj)){
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}


FIXXED!!!1111eleven!

Also, improved the formatting. Because I'm a nitpicking jerk.  :V
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."

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #766 on: January 02, 2010, 05:01:36 PM »
Ok, so i"ve made this spellcard and stuff.

So when I tried it out this, it crashes.
Code: (Bleh. it just crashes, no script error or anything.) [Select]
#TouhouDanmakufu[Stage]
<snip>

 @Finalize{
  LoadGraphic(EFamiliar);
 }

Code: (theattack.txt) [Select]
#TouhouDanmakufu
#Title[Works here, though.]
#Text[]
#Image[]
#BackGround[IceMountain]
#Player[FREE]
#ScriptVersion[2]

<snip>
Does it crash upon loading the stage or whenever you try to spawn the boss?

I could of course be wrong, but it strikes me that spawning a familiar with a #BackGround[IceMountain] of himself inside another script could be a bad idea.
Having a LoadGraphic in @Finalize, likewise, although that shouldn't arise until the end of the stage.

I would test around with this, but danmakufu hates me right now. It crashes on pretty much everything, including beating a script of any kind, loading a stage and/or looking at it weirdly. :-X
Gonna try and screw around with the compatibility settings and stuff...
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #767 on: January 02, 2010, 05:01:46 PM »
Now I understand why I couldn't come anywhere close it. I was fooling around with sin / cos and Obj_SetAngle. But you are using Obj_SetPosition which has like XY also two parameters. Clever.

However, the bullets are like falling sideways ( if I use pellets or ovals ). How can I make the bullet angle cooperate as well ?

Code became eventually this:
Code: [Select]
    task sproeibullet(x,y,kleur,delay){

let obj=Obj_Create(OBJ_SHOT);

    let flyangle=rand(240,270);
    let ac = 0.1;
    let xv = 5*cos(flyangle);
    let yv = 5*sin(flyangle); //x,y velocity

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);

    loop(60){
      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
      yv += ac;
      yield;
    }
loop(60){yield;}
    while(!Obj_BeDeleted(obj)){
      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
Obj_SetAngle(obj,flyangle);
      yv += ac;
      yield;
}
    }

Edit - frikken forum, why does it overthrow the order of tabbing when using code tags =.=

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #768 on: January 02, 2010, 05:16:16 PM »

However, the bullets are like falling sideways ( if I use pellets or ovals ). How can I make the bullet angle cooperate as well ?
Obj_SetAngle() and to the rescue!


Code: [Select]
    task sproeibullet(x,y,kleur,delay){

let obj=Obj_Create(OBJ_SHOT);

    let flyangle=rand(240,270);
    let ac = 0.1;
    let xv = 5*cos(flyangle);
    let yv = 5*sin(flyangle); //x,y velocity

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);

    loop(60){
      yv += ac;

      Obj_SetAngle(obj, 180+ atan(yv/xv)); //This one line here!

      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);


      yield;
    }
loop(60){yield;}
    while(!Obj_BeDeleted(obj)){
      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);

      Obj_SetAngle(obj, 180+ atan(yv/xv)); //This same line here!

      yv += ac;
      yield;
}
    }
I tested this very code using RED32s, and it looked fine to me.
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #769 on: January 02, 2010, 05:31:38 PM »
Oh frikken brilliant. Right so let me try to grasp this:

Basically you are using the same math you used for the SetShotDataA_XY. XY used  X-velocity and Y-velocity as a seperate parameter, in this case I can do the same by giving the same parameters to the object task:

sproeibullet(x,y,xspeed,yspeed,kleur,delay)

Then it is basically the same thing, the angle being throw by 'flyangle' is used to calculate xv and yv where cos is used for the x and sin for the y ( logic trig )

And 'ac' is simply the acceleration rate which is added everytime to 'yv' because obviously we want the vertical velocity to increase over time ( in this case, per frame ) Eventually it is a simple matter of using 'SetPosition' adding the xv and yv to  Obj_GetX and Y.

Basically, I could write out the math code also like this no: 

sproeibullet(GetEnemyX,GetEnemyY,5*cos(240),5*sin(240),RED32,10);   where  the 3rd and 4th are the velocity parameters for x and y ( just like ShotA_XY )

?? Did I understood it all correctly, teacher ??

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #770 on: January 02, 2010, 05:38:52 PM »
whenever you try to spawn the boss

This.

Also, screw-up on LoadGraphic instead of DeleteGraphic :V

EDIT: HOLY FREAK THANKS I WAS SCREWING OVER THIS THING FOR SO LONG ~_~
« Last Edit: January 02, 2010, 05:46:05 PM by Always ろ⑨ »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #771 on: January 02, 2010, 05:48:55 PM »
?? Did I understood it all correctly, teacher ??
Correct!  8)

You still fail the class because I can't find an appropriate picture of Keine right now, though.  :V

This.
I can assume you did test the #Background issue, yes? Other than that, I cannot spot anything that might be causing the crashes right now. Nothing I understand, at least.  :V
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."

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #772 on: January 02, 2010, 11:57:29 PM »
the #Background issue
Thanks! I can't believe #BackGround was causing all this... ~_~

kite216

Re: Danmakufu Q&A/Problem Thread II
« Reply #773 on: January 03, 2010, 03:07:49 AM »
This question has probably been asked and answered before but i cnat seem to find anything on it. Im running windows vista and i have applocale and i jsut downloaded danmakufu. now i had it a relaly long time ago on this computer and it worked fine with applocale but now since i've just downloaded it again, i had deleted the previous version a while ago, when it opens up i jsut get the application window open then it says th_dnh.exe (the program) has stopped working. My options are clsoe the program, or check online for a solution and clsoe the program. Is there any way to fix this?

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #774 on: January 03, 2010, 03:29:59 AM »
I'm not to familiar with AppLocale, but I don't think there's enough information to figure out the problem. I can suggest the usual stuff like, "Are you sure you're choosing Japanese?"  but that's about it. Have you taken a look at this thread yet?
<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.

Nimono

  • wat
Re: Danmakufu Q&A/Problem Thread II
« Reply #775 on: January 03, 2010, 03:39:11 AM »
This question has probably been asked and answered before but i cnat seem to find anything on it. Im running windows vista and i have applocale and i jsut downloaded danmakufu. now i had it a relaly long time ago on this computer and it worked fine with applocale but now since i've just downloaded it again, i had deleted the previous version a while ago, when it opens up i jsut get the application window open then it says th_dnh.exe (the program) has stopped working. My options are clsoe the program, or check online for a solution and clsoe the program. Is there any way to fix this?
For some reason, the program refuses to run on Windows 7 unless you right-click the link to Danmakufu and select "Run as Administrator". I'm positive this will work for you, too.


Question of my own: I've recently been informed that there is a second type of object laser, the sinuate laser that curves like CreateLaserC. (heck yes this is so freaking win) I have problems with it, though...

You know the stereotypical thin, homing laser that most shmups these days seem to have? (As far as I know, at least...) I'm trying to create that. It actually works surprisingly well, but...there's a few problems.

Code: [Select]
let shotCount = -1;
let bNextShot = false;
let optionx = 0;
let optiony = 0;
let optionx2 = 0;
let optiony2 = 0;
let optionx3 = 0;
let optiony3 = 0;
let optionx4 = 0;
let optiony4 = 0;
let oang = 115;
let oang2 = 65;
let oang3 = 155;
let oang4 = 25;
let ooffset = 39;
let angle = 270;
let rot = 0;
let IsShooting = false;
task Laser(x, y, angle, power, l, w, g, a, s, loc)
{
let maxTraverse = 5;
let rev = false;
let Time = 0;
let Fall = Obj_Create(OBJ_SINUATE_LASER);
ObjShot_SetDamage(Fall, power);
Obj_SetPosition(Fall, x, y);
ObjShot_SetPenetration(Fall, 1000000);
ObjShot_SetGraphic(Fall, g);
Obj_SetSpeed(Fall, s);
Obj_SetAngle(Fall, angle);
Obj_SetAlpha(Fall, a);
ObjSinuateLaser_SetWidth(Fall, w);
ObjSinuateLaser_SetLength(Fall, l);
while(!Obj_BeDeleted(Fall))
{
ObjSinuateLaser_SetLength(Fall, l);
if(Time >= 5)
{
Obj_SetAngle(Fall, angle);
let dir;
dir = atan2(GetEnemyY - Obj_GetY(Fall), GetEnemyX - Obj_GetX(Fall));
// difference between 'dir' and 'angle'
let diff = dir - angle;
while(diff >= 180) { diff -= 360; }    // adjust the range
while(diff < -180) { diff += 360; }
let diffAbs = (|diff|);
if(diffAbs < maxTraverse)
{
// if the difference is small,
// the bullet turns to the enemy
angle = dir;
}
else
{
// otherwise, the bullet turns 'maxTraverse' degrees
if(loc == "left")
{
angle += (|maxTraverse * diff / diffAbs|);
}
else
{
angle -= (|maxTraverse * diff / diffAbs|);
}
}
if(Time >= 10 && maxTraverse < 25)
{
maxTraverse++;
}
}
if(GetKeyState(VK_SHOT) == KEY_HOLD)
{
l+=10;
}
if((Obj_GetX(Fall) >= GetEnemyX-10 && Obj_GetX(Fall) <= GetEnemyX+10 && Obj_GetY(Fall) >= GetEnemyY-10 && Obj_GetY(Fall) <= GetEnemyY+10) && GetEnemyNum >= 1)
{
l-=10;
Obj_SetSpeed(Fall, 0);
}
else
{
Obj_SetSpeed(Fall, s);
}
Time++;
yield;
}
}
@MainLoop
{
rot += 5;
optionx = GetPlayerX+ooffset*cos(oang);
optiony = GetPlayerY+ooffset*sin(oang);
optionx2 = GetPlayerX+ooffset*cos(oang2);
optiony2 = GetPlayerY+ooffset*sin(oang2);
optionx3 = GetPlayerX+ooffset*cos(oang3);
optiony3 = GetPlayerY+ooffset*sin(oang3);
optionx4 = GetPlayerX+ooffset*cos(oang4);
optiony4 = GetPlayerY+ooffset*sin(oang4);
if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && shotCount==-1)
{
shotCount = 0;
bNextShot = false;
}
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
{
if(ooffset > 21)
{
ooffset-=3;
}
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && !IsShooting)
{
Laser(optionx, optiony, 90, 4.0, 10, 15, 12, 190, 8, "left");
Laser(optionx2, optiony2, 90, 4.0, 10, 15, 12, 190, 8, "right");
Laser(optionx3, optiony3, 105, 4.0, 10, 15, 12, 190, 8, "left");
Laser(optionx4, optiony4, 75, 4.0, 10, 15, 12, 190, 8, "right");
IsShooting = true;
}
}
else
{
if(ooffset < 39)
{
ooffset+=3;
}
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && !IsShooting)
{
Laser(optionx, optiony, 90, 2.0, 10, 15, 12, 190, 8, "left");
Laser(optionx2, optiony2, 90, 2.0, 10, 15, 12, 190, 8, "right");
Laser(optionx3, optiony3, 90, 2.0, 10, 15, 12, 190, 8, "left");
Laser(optionx4, optiony4, 90, 2.0, 10, 15, 12, 190, 8, "right");
IsShooting = true;
}
}
if(shotCount%2 == 0)
{
//CreatePlayerShot01(GetPlayerX-8, GetPlayerY, 20, 270, 2.4, 1, 1);
//CreatePlayerShot01(GetPlayerX+8, GetPlayerY, 20, 270, 2.4, 1, 1);
}

if(shotCount >= 0)
{
shotCount++;
}
if(shotCount == 30)
{
shotCount=-1;
}
if(GetKeyState(VK_SHOT) != KEY_PUSH && GetKeyState(VK_SHOT) != KEY_HOLD)
{
IsShooting = false;
}

SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);
yield;
}

For some reason, a length of 10 is too long for the laser, as once the laser reaches the enemy, where it shrinks, it...well, it shows a random series of images from my shot graphics sheet. :/ Second, when I hold down the shot key, which is what makes it extend, the graphics start out really compressed in size and very slowly get bigger to the correct size they should be. Finally, when they're SUPPOSED to shrink after letting go of shot, the lasers seem to immediately vanish into garbled areas. What am I doing wrong, if anything? Does the graphic need to be a certain size? Does the laser itself need to be?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #776 on: January 03, 2010, 01:38:39 PM »
I am looking for an oval shaped movement pattern for the boss. I tried: SetMovePosition03(x+r*cos(dir),y+r*sin(dir),weight,frames);   but makes the boss look like it has parkinson.

Then I noticed the 'SetMovePositionHermite' function though the parameters are making no sense to me.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #777 on: January 03, 2010, 02:32:57 PM »
That function is way too difficult for mortals to understand. My idea for a workaround would be to just use SetX and SetY.

Code: [Select]
task ellipse{
    let dir=270;
    let rx=150;
    let ry=75;

    loop{
        dir++;
        SetX(x+rx*cos(dir));
        Sety(y+ry*sin(dir));
        yield;
    }
}

...or something like that.
« Last Edit: January 03, 2010, 02:36:39 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #778 on: January 03, 2010, 03:00:34 PM »
That function is way too difficult for mortals to understand.

Dohohohoho.   

* Helepolis spawns a spear the gungnir

But seriously, what does it exactly do. Or what can it do.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread II
« Reply #779 on: January 03, 2010, 03:23:33 PM »
Dohohohoho.   

* Helepolis spawns a spear the gungnir

But seriously, what does it exactly do. Or what can it do.

from what's written in the wiki (and because I've used it from time-to-time), it seems like it's making the enemy move in a curve where the arguments mean:
Code: [Select]
7 arguments:
 1) X-coordinate //x-coordinate where the enemy will go to
 2) Y-coordinate //y-coordinate where the enemy will go to
 3) distance to curve from beginning point //until how far from the starting place the starting curve will last
 4) angle at beginning point //at what angle the boss starts to move from the starting place
 5) distance to curve to ending point //how far from the ending spot the enemy will start to curve
 6) angle at ending point //from what angle the enemy will arrive at the ending point
 7) frames //how long it'll take

basically it's like... if
SetX(GetCenterX);
SetY(GetClipMinY+100);
SetMovePositionHermite(GetClipMinX-100, GetClipMaxY-100, 100, 90, 100, 180, 100);
will make something like

_____________
|                  |
|        B        |
|        |        |
|        |        |
|        |        |
|        /        |
|<----          |
|___________| (<---  maybe the 3rd and 5th arguments are a little off in that picture)
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry