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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #180 on: September 30, 2012, 09:09:42 PM »
I need some help. After I removed my last script on accident, I decided to relearn Danmakufu. So far, so good, until I got to the part about sprite animation. Certain frames show the entire sprite sheet instead of just the SetGraphicRect, even after I changed it so they would all be the same image. Here is a screenshot:

And here is the @DrawLoop part of my script:
Code: [Select]
    @DrawLoop {
SetTexture(sakuya);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);

if(int(GetSpeedX())==0) {
if(f<10){SetGraphicRect(44,34,87,95);}
if(f>=10 && f<20){SetGraphicRect(44,34,87,95);}
if(f>=20 && f<30){SetGraphicRect(44,34,87,95);}
}

DrawGraphic(GetX,GetY);

f++;
if (f==40){f=0;}

    }
FYI, I'm using Sakuya sprites from CtC. If someone could help me, that would be great, Thanks. :)
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #181 on: September 30, 2012, 10:19:11 PM »
Where's frames 30 to 40? Can I assume f starts at 0?

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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #182 on: September 30, 2012, 11:31:22 PM »
My animation only has three frames. I figured out where I put in a number wrong. I assume f starts at zero.
My Youtube Channel. I mostly upload Hisoutensoku videos.

I have no name

  • Dodge ALL the bullets
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #183 on: September 30, 2012, 11:59:23 PM »
Code: [Select]
if (f==40){f=0;}is the problem.  It should be f==30.

Code: [Select]
if(int(GetSpeedX())==0) {
if(f<10){SetGraphicRect(44,34,87,95);}
if(f>=10 && f<20){SetGraphicRect(44,34,87,95);}
if(f>=20 && f<30){SetGraphicRect(44,34,87,95);}
}
Additionally, this code is setting the graphic to the same spot for frames 0-10, 10-20 and 20-30.  You'll need to adjust the graphic rectangle for the latter 2.

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #184 on: October 01, 2012, 12:44:37 AM »
I realize both of those things. I was just testing at the time.

Now, I cannot, for the life of me, get these image coordinates correct! I've tried GIMP, paint and even an image mapping website, and nothing's working! Frame 1 shows the next sprite's scalp, frame 2 is a few pixels below and frame 3 doesn't show up at all (waaaaaaaaay below). I get approximates, but they don't work! Am I using CtC sprites right? Here's the image I'm working with:

and my new @DrawLoop:
Code: [Select]
    @DrawLoop {
SetTexture(sakuya);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);

if(int(GetSpeedX())==0) {
if(f<10){SetGraphicRect(50,34,76,94);}
if(f>=10 && f<20){SetGraphicRect(50,160,76,94);}
if(f>=20 && f<30){SetGraphicRect(50,294,76,94);}
}


DrawGraphic(GetX,GetY);

f++;
if (f==30){f=0;}

    }
Please help! Thanks.
« Last Edit: October 01, 2012, 12:47:01 AM by LadyScarlet »
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #185 on: October 01, 2012, 03:18:19 AM »

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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #186 on: October 01, 2012, 03:26:00 AM »
Sorry to be so stupid, but would you mind explaining that in words? I don't quite comprehend the image. Maybe I ought to replace Sakuya with Cirno...
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #187 on: October 01, 2012, 03:43:41 AM »
SetGraphicRect(50,34,76,94) gives you the first rectangle.
SetGraphicRect(50,160,76,94) gives you the second rectangle upside-down.
SetGraphicRect(50,294,76,94) gives you the second and third rectangle upside-down.

Your coordinates aren't right. One of the rects should probably be working, at least.

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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #188 on: October 01, 2012, 04:23:20 AM »
Isn't it left, top, right, bottom? I believe I only have to change the second value.
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #189 on: October 01, 2012, 05:40:39 AM »
It is LTRB.
Your second rect is saying 160 is the top of the rectangle and 94 is the bottom, so it's both upside-down and not actually selecting any sprite.
Your third rect is saying 294 is the top of the rectangle and 94 is the bottom, so it's selecting a really long rectangle that is upside-down, which has the second sprite near its middle, and the third sprite's hair near the top (both upside-down).

I'm not sure why you would think you don't have to change the bottom bound, of course you do.

The correct rects should be around
(49,35,77,95)
(49,163,77,223)
(49,291,77,351)
left, top, right, bottom

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

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #190 on: October 01, 2012, 02:48:41 PM »
Thanks for the help. I can't believe how dumb I was. :colonveeplusalpha:
My Youtube Channel. I mostly upload Hisoutensoku videos.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #191 on: October 07, 2012, 10:22:24 AM »
Hi all, i have a big problem concerning objects and not only.

So, first problem:

  i know how to make a circle of bullets with a x radius. I know that with getx+rcos(angle) and gety+r*sin(angle) i can make it spin... i also know that if i put a positive speed the circle expand.
 What i would really like to know is how to make the circle spin without expanding. Something like the moon, that moves around our planet but her "radius" is always the same.

Second problem: i know how bullet object works and i know how to use them. But sadly, i keep not understanding effect object... can someone kindly explain them to me? Maybe with an example? The only effect obj i know is the nue spell in which she create the black clouds , but obviously i don't even know where to start to make that.

Thanks



Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #192 on: October 07, 2012, 03:20:51 PM »
  i know how to make a circle of bullets with a x radius. I know that with getx+rcos(angle) and gety+r*sin(angle) i can make it spin... i also know that if i put a positive speed the circle expand.
 What i would really like to know is how to make the circle spin without expanding. Something like the moon, that moves around our planet but her "radius" is always the same.
Shame. I don't know Danmakufu, but I know that here you must replace "getx" and "gety" with values that wouldn't depend on bullet's position. ._.
Hmm... something like that: "angle = angle + rotationSpeed * deltaTime; x = centerX + radius * cos (angle); y = centerY + radius * sin (angle)"; I hope you'll catch my idea.

The Jealous Witch did nothing wrong.

fondue

  • excuse me
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #193 on: October 07, 2012, 03:42:13 PM »
lolnope
I think he means for the bullet's X position he wants:
Code: [Select]
GetX+n*cos(t)
And for Y:

Code: [Select]
GetY+n*sin(t)
Replace n with a number, 50 for example. And replace t with a changing variable that every frame it increases by 1.
If he wants bullets to spawn then he should use CreateShot01 or something and input the X and Y things I made into the parameters.
If he wants something to rotate around the enemy the he will want to change the object's position every frame with the pieces of code I gave him.

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #194 on: October 08, 2012, 05:14:35 AM »
I thought GetX returns current bullet's position.

Also, . `v`

The Jealous Witch did nothing wrong.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #195 on: October 08, 2012, 05:22:28 AM »
uhm... thank you for the answers, but i did not understand much.

How should i control the bullet position in the object task in order to make the bullet spin in the circle without the expansion of said circle?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #196 on: October 08, 2012, 05:47:07 AM »
I thought GetX returns current bullet's position.
No, it returns the current enemy's position. In a enemy boss script it returns the boss position, in an enemy script it returns the enemy position. Obj_GetX(obj) will return the object's x-position, which is what you're thinking of. However, both you and fondue are saying the same thing.

Second problem: i know how bullet object works and i know how to use them. But sadly, i keep not understanding effect object... can someone kindly explain them to me? Maybe with an example? The only effect obj i know is the nue spell in which she create the black clouds , but obviously i don't even know where to start to make that.
http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial
Stuff's player script tutorial has some good examples too: http://www.shrinemaiden.org/forum/index.php/topic,210.0.html

Quote
How should i control the bullet position in the object task in order to make the bullet spin in the circle without the expansion of said circle?
http://www.shrinemaiden.org/forum/index.php/topic,865.0.html Look at the trigonometry part again and try and understand what's going on here:

Obj_SetX(obj, centerX + cos(t)*radius );
Obj_SetY(obj, centerY + sin(t)*radius );
t+=something;


Loop the above per frame. Every frame t will increase, and the object will move horizontally from the center position to cos(t) times the circle radius, and vertically sin(t) times the radius. If you still don't understand, get rid of either the SetX or the SetY and see how the object moves then.
« Last Edit: October 08, 2012, 06:45:21 AM by Drake »

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

fondue

  • excuse me
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #197 on: October 08, 2012, 09:48:06 AM »

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins

The Jealous Witch did nothing wrong.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #199 on: October 08, 2012, 12:58:33 PM »
Thanks, it works!

that's what i made :

task Bullet(x, y, v, angle, graphic, delay,radius) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);
      let t = 0;
      loop{
      Obj_SetX(obj, 224 + cos(t)*radius );
      Obj_SetY(obj, 240 + sin(t)*radius);
      t+= 1;
      yield;
      }      
}

Only, i founded problems while doing a circle. because if i call  Bullet(x, y, v, angle, graphic, delay,radius) in a (for example) loop(8) with angle += 360/8; the ring don't appear. And that is because the ring do what the obj says, so all 8 bullets go in

Obj_SetX(obj, 224 + cos(t)*radius );
Obj_SetY(obj, 240 + sin(t)*radius);

That define x,y of only 1 point. So, in order to make a ring of 8 bullets, i did:

loop(8){
      Bullet(GetX, GetY, 0, angle, 188, 30,90);
      angle += 360/8; wait(48);
      }

where wait(48); is used to spawn the 8 bullets in a circle. The problem is that each bullets move when is spawned , so at the end i can't do 8 bullets with the same distance...some bullets are too near or too far from the others.

Do you know a way to correct this maybe?

puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #200 on: October 08, 2012, 05:59:20 PM »
I want to get a bit more advanced with object effects and make something that uses more than 4 vertices.
The problem is, how do I set the coordinates? I tried various tests to make a 3x3 grid instead of the usual 2x2, but the closest I got was this:



The picture does not deform, but it is missing 4 triangles. (and it became some sort of SS flag...)

This is my current code:
Code: [Select]
task Effect{
let frame=0;

let xsize=300;
let ysize=300;
let obj=(Obj_Create(OBJ_EFFECT));

Obj_SetPosition(obj,cx,cy);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetLayer(obj,1);
ObjEffect_SetTexture(obj,EFtest);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj,8);

ObjEffect_SetVertexXY(obj,0,-150,-150);
ObjEffect_SetVertexXY(obj,1,0,-150);
ObjEffect_SetVertexXY(obj,2,150,-150);
ObjEffect_SetVertexXY(obj,3,-150,0);
ObjEffect_SetVertexXY(obj,4,0,0);
ObjEffect_SetVertexXY(obj,5,150,0);
ObjEffect_SetVertexXY(obj,6,-150,150);
ObjEffect_SetVertexXY(obj,7,0,150);
ObjEffect_SetVertexXY(obj,8,150,150);

ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,150,0);
ObjEffect_SetVertexUV(obj,2,300,0);
ObjEffect_SetVertexUV(obj,3,0,150);
ObjEffect_SetVertexUV(obj,4,150,150);
ObjEffect_SetVertexUV(obj,5,300,150);
ObjEffect_SetVertexUV(obj,6,0,300);
ObjEffect_SetVertexUV(obj,7,150,300);
ObjEffect_SetVertexUV(obj,8,300,300);

while(Obj_BeDeleted(obj)==false){

frame++;
yield;
}
}

How do I fix this? And how do you make circular shapes like the health bar in 10 Desires?
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

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #201 on: October 09, 2012, 03:08:43 AM »
It actually is deformed, you just can't see the deformed parts because they're lines.

With STRIP, a vertex t connects to the vertices t+1 and t+2.
With FAN, a vertex t connects to the vertices 0 and t+1.
With LIST, every three vertices connect to only each other.


edit: oops in fan, 1 does not connect to 7; you need an extra vertex for that

To answer your second question, look at fans. Then make a fan with lots of vertices that form a circle. Then use an image that only shows up at the open end of the triangle, and poof you get a ring.
« Last Edit: October 10, 2012, 03:24:53 AM by Drake »

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

SusiKette

  • @MainLoop { yield; }
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #202 on: October 09, 2012, 02:28:53 PM »
EDIT: Problem fixed. My variable "CutIn" was confusing Danmakufu as it also is a name of the cut in function. But I also ran in another problem, the background appears black

I got this error during scripting and I don't know how to fix it:


here is the script:
Code: [Select]
#TouhouDanmakufu
#Title[Reimu Attack #1]
#Text[Reimu's Non-Spell Attack #1]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\BGM\A Maiden's Capriccio ~ Dream Battle.mp3"]

script_enemy_main {

#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let CutIn = CSD ~ "IMG\CutInBoss.png";
let Boss = CSD ~ "IMG\ImgBoss.png";
let BottomBG = CSD ~ "IMG\SpellBGB";
let TopBG = CSD ~ "IMG\SpellBGT";
let f = 0;
let f2 = 0;
let slide = 0;

@Initialize {
shotinit;
SetLife(1500);
SetTimer(35);
SetScore(53200);
SetDamageRate(100, 25);
SetInvincibility(120);
SetEnemyMarker(true);
LoadGraphic(CutIn);
LoadGraphic(Boss);
LoadGraphic(BottomBG);
LoadGraphic(TopBG);
CutIn(YOUMU, "Test", CutIn, 0, 0, 503, 266);
SetMovePosition03(GetCenterX, GetCenterY-120, 7, 3);
mainTask;
}

@MainLoop {
SetCollisionA(GetX, GetY, 24);
SetCollisionB(GetX, GetY, 24);
yield;
}

@DrawLoop {
SetTexture(Boss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);

if(int(GetSpeedX())==0) {
if(f<10){ SetGraphicRect(13, 2, 52, 73); }
if(f>=10 && f<20){ SetGraphicRect(77, 2, 116, 73); }
if(f>=20 && f<30){ SetGraphicRect(141, 2, 180, 73); }
if(f>=30){ SetGraphicRect(205, 2, 244, 73); }
f2=0;
}

if(GetSpeedX()>0) {
if(f2<5){ SetGraphicRect(11, 82, 51, 153); }
if(f2>=5 && f2<10){ SetGraphicRect(65, 82, 118, 153); }
if(f2>=10 && f2<15){ SetGraphicRect(130, 82, 186, 153); }
if(f2>=15){ SetGraphicRect(194, 82, 248, 153); }
f2++;
}

if(GetSpeedX()<0) {
SetGraphicAngle(180, 0, 0);
if(f2<5){ SetGraphicRect(11, 82, 51, 153); }
if(f2>=5 && f2<10){ SetGraphicRect(65, 82, 118, 153); }
if(f2>=10 && f2<15){ SetGraphicRect(130, 82, 186, 153); }
if(f2>=15){ SetGraphicRect(194, 82, 248, 153); }
f2++;
}

DrawGraphic(GetX, GetY);

f++;
if(f==40) {f=0;}
}

@BackGround {
SetTexture(BottomBG);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0, 0, 256, 256);
SetGraphicScale(2, 2);
SetGraphicAngle(0, 0, 0);
DrawGraphic(GetCenterX, GetCenterY);

SetTexture(TopBG);
SetRenderState(ALPHA);
SetAlpha(155);
SetGraphicRect(0, 0, 256+slide, 256+slide);
SetGraphicScale(2, 2);
SetGraphicAngle(0, 0, 0);
DrawGraphic(GetCenterX+slide, GetCenterY+slide);

slide+=2;
}

@Finalize {
DeleteGraphic(CutIn);
DeleteGraphic(Boss);
DeleteGraphic(BottomBG);
DeleteGraphic(TopBG);
}

task mainTask {
wait(90);
movement;
}

task movement {
loop {
SetMovePositionRandom01(rand_int(50, 150), rand_int(50, 150), 2, GetClipMinX+60, GetClipMinY+60, GetClipMaxX-60, GetCenterY-120);
wait(180);
yield;
}
}

function wait(w) {
loop(w) {yield;}
}
}
and now that I'm posting something, can someone tell me that if I can safely update danmakufu to ph3 without it making my scripts unplayable
« Last Edit: October 09, 2012, 02:45:44 PM by Yukkuri_Yukkuri_Yukkuri »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #203 on: October 09, 2012, 06:16:34 PM »
EDIT: Problem fixed. My variable "CutIn" was confusing Danmakufu as it also is a name of the cut in function. But I also ran in another problem, the background appears black

I got this error during scripting and I don't know how to fix it:
image removed from quote

here is the script:
Code: [Select]
holy shit lots of codeand now that I'm posting something, can someone tell me that if I can safely update danmakufu to ph3 without it making my scripts unplayable

1.) Please use pastebin when posting large blocks of code. Not only does it have line numbers for easy reference, it also makes it easier to scroll through pages of the thread.
2.) Run the program in Japanese locale. It looks like it's currently running in Chinese so the error is written in gibberish Chinese. You want the language that looks like 日本語
3.) I don't see a problem with your code for your drawing, so you're probably loading the images incorrectly somehow. Check your paths? That's the best I can think of at the moment.
4.) Incidentally, your background's logic has a problem, but fixing it won't make it show up without fixing something else that I don't know about first. SetGraphicRect(0, 0, 256+slide, 256+slide); will cause Danmakufu to draw a larger and larger image as time goes on. I believe you mean SetGraphicRect(slide, slide, 256+slide, 256+slide); which draws a 256x256 at all times. DrawGraphic(GetCenterX+slide, GetCenterY+slide); is also incorrect as that will move the image's center until it moves off screen. Just do DrawGraphic(GetCenterX, GetCenterY);
5.) Moving anything from 0.12m to ph3 will break the script entirely. 0.12m scripts only work on 0.12m and ph3 scripts only work on ph3. If you want to learn Danmakufu, stick with one. 0.12m is more beginner friendly so I'd suggest you stick with that. You would really only ever move to ph3 when you hit one of the limits of 0.12m that most people do not hit.
<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.

puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #204 on: October 10, 2012, 05:33:15 PM »
It actually is deformed, you just can't see the deformed parts because they're lines.

With STRIP, a vertex t connects to the vertices t+1 and t+2.
With FAN, a vertex t connects to the vertices 0 and t+1.
With LIST, every three vertices connect to only each other.

To answer your second question, look at fans. Then make a fan with lots of vertices that form a circle. Then use an image that only shows up at the open end of the triangle, and poof you get a ring.

Thanks, now I understand how it works.
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

SusiKette

  • @MainLoop { yield; }
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #205 on: October 11, 2012, 06:11:29 AM »
I don't see a problem with your code for your drawing, so you're probably loading the images incorrectly somehow. Check your paths? That's the best I can think of at the moment.
Yeah, I noticed that I forgot to add the .png after the bg images.

Incidentally, your background's logic has a problem, but fixing it won't make it show up without fixing something else that I don't know about first. SetGraphicRect(0, 0, 256+slide, 256+slide); will cause Danmakufu to draw a larger and larger image as time goes on. I believe you mean SetGraphicRect(slide, slide, 256+slide, 256+slide); which draws a 256x256 at all times. DrawGraphic(GetCenterX+slide, GetCenterY+slide); is also incorrect as that will move the image's center until it moves off screen. Just do DrawGraphic(GetCenterX, GetCenterY);
If I remember right this technic was in one of Helepolis's youtube tutorials as an added on-screen text saying that you could mage it this way too.

Also, I am making a attack that fires amulets up, down, left and right from random position and I want to make it so that the amulets don't spawn too close to the player
Here is one of the 4 fire tasks. Only difference between the tasks is the direction and colour. As far as I have tested it has worked, but because it's based on randomization it might not work at all, just begin' lucky not to get amulets spawned on the player
Code: [Select]
task fire01 {
let x = rand(GetClipMinX, GetClipMaxX);
let y = rand(GetClipMinY, GetClipMaxY);
loop {
CreateShotA(1, x, y, 20);
SetShotDataA(1, 0, 0, 0, 0, 0.015, rand(2, 5), BLUE56);
PlaySE(CSD ~ "SFX\se_tan02.wav");
if(x>GetPlayerX+20 || x<GetPlayerX-20 && y>GetPlayerY+20 || y<GetPlayerY-20) {
FireShot(1);
}
x = rand(GetClipMinX, GetClipMaxX);
y = rand(GetClipMinY, GetClipMaxY);
wait(5);
yield;
}
}

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #206 on: October 11, 2012, 06:45:36 AM »
Well, you get the picture at least, but you're missing brackets. Another issue is that it won't actually fire every 5 frames, and that it'll still play the sound effect. Instead, just loop the random firing position until you get one within the proper bounds.
Also, the wait() function is defined as looping yields. wait(5); yield; is the same as wait(6); so you don't need that last yield there.
Code: [Select]
task fire01 {
let x;
let y;
loop {
x = rand(GetClipMinX, GetClipMaxX);
y = rand(GetClipMinY, GetClipMaxY);
while( (x<GetPlayerX+20 || x>GetPlayerX-20) && (y<GetPlayerY+20 || y>GetPlayerY-20) ){
//note the extra parentheses, and the flipped < > because I flipped your condition around
//get new firing points until it's away from the player
x = rand(GetClipMinX, GetClipMaxX);
y = rand(GetClipMinY, GetClipMaxY);
}
//so now you will always be firing bullets each time the task loops
CreateShotA(1, x, y, 20);
SetShotDataA(1, 0, 0, 0, 0, 0.015, rand(2, 5), BLUE56);
PlaySE(CSD ~ "SFX\se_tan02.wav");
FireShot(1);

wait(5); //<-- this is just five yields
}
}
« Last Edit: October 11, 2012, 06:49:35 AM by Drake »

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

SusiKette

  • @MainLoop { yield; }
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #207 on: October 11, 2012, 04:11:24 PM »
Well, you get the picture at least, but you're missing brackets. Another issue is that it won't actually fire every 5 frames, and that it'll still play the sound effect. Instead, just loop the random firing position until you get one within the proper bounds.
Also, the wait() function is defined as looping yields. wait(5); yield; is the same as wait(6); so you don't need that last yield there.

Danmaku freezed, lol
Not sure what caused it in the new code, but I know it can't be the new bg code that I added at the same time, because I pasted it to all of my pre-made spell card bases and they worked just fine

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #208 on: October 11, 2012, 04:46:02 PM »
Drake's code looks correct to me. Is there a yield in your @MainLoop?
<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.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #209 on: October 12, 2012, 12:30:22 AM »
Herp nope.

while( x<GetPlayerX+20 && x>GetPlayerX-20 && y<GetPlayerY+20 && y>GetPlayerY-20 ){

before it looped for all values lol

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