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

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #780 on: January 04, 2012, 01:36:12 AM »
You can try sticking Retry(); in instead of repeating the spellcard. That will cause the script to restart and clear any replay data. If you want anything more complicated, Azure had a system that worked for replays that can skip menus and stuff. It involved Retry() and common data, but I can't quite remember off the top of my head.

Yeah I had thought of using Retry, but if that resets the entire script, then it would also reset the music from the beginning too, no? It's the resetting of the music that I wanted to avoid, honestly. I loved that the music would continue after each attempt in IN and TD.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #781 on: January 04, 2012, 09:43:03 AM »
It's the resetting of the music that I wanted to avoid, honestly. I loved that the music would continue after each attempt in IN and TD.
Unfortunately that cannot be avoided, as such are the limitations of the 0.12m engine. Maybe if Ph3 becomes stable (hopefully soon),  you can set looping areas in the song and simply fade the music to lower volume and increase again while playing.

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #782 on: January 04, 2012, 06:33:42 PM »
Man, I'm such a spammer >.>, but, this set of CreateShotA keep messing up,
Code: [Select]
               PlaySE( BulletOrbShot01 );

             CreateShotA( 1, GetX, GetY, 10 );
             SetShotDataA( 1, 0, 3, 0, 0, 3.5, 4, 165 );
             SetShotDataA( 1, 35, 3, 90, 0, 2.9, 3.1, 165 );
              ascent( i in 1..60 ){
               CreateShotA( 2, 0, 0, 30 );
               SetShotDataA( 2, 0, 1, 0, 0, 1.1, 1.2, 17 );
               SetShotDataA( 2, 30, 3, GetAngleToPlayer+i*10-20, 0, 3, 2.8, 17 );
               AddShot( i*2, 1, 2, 0 );
       

               SetAction( ACT_SHOT_A, 30 );
            }
     FireShot( 1 );
           }
        }

It won't display the boss sprite along with firing bullets -.-. Did I screw up somewhere?

EDIT: Fixed the Bullet problem, now how to fix the boss sprite problem? Also, new problem, only displays this shot not the other shots
« Last Edit: January 04, 2012, 06:58:08 PM by Yuuka »
" Borders are Borders. They were meant to be manipulated and mistreated. "

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #783 on: January 04, 2012, 09:30:50 PM »
We cannot guess what is wrong with your boss sprite since you are showing us createshoteA code and not a pastebin link with your entire script. Please post a pastebin link to your full script.

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #784 on: January 04, 2012, 09:44:48 PM »
We cannot guess what is wrong with your boss sprite since you are showing us createshoteA code and not a pastebin link with your entire script. Please post a pastebin link to your full script.

Oops. Well I kinda solved the problem already. Sorry. Can you delete the post?
" Borders are Borders. They were meant to be manipulated and mistreated. "

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #785 on: January 06, 2012, 01:50:54 AM »
Hey, I'm new here, and I've recently gotten into Danmakufu. Still sort of a beginner, but I was wondering how you would do this:

-> 3 concentric circles, their center is the center of the game screen (NOT drawn, just so you know)
->bullets spawned from the middle, doesn't really matter atm
->when bullets collide with a point on a circle, they teleport to another point, and have the delay cloud thing where they come out (I know you can use Obj_SetPosition to reposition the bullet, but I can't figure out the delay cloud. Do I have to make an object effect?)
->the teleport order thing sorta goes like this:

(<-5         <-4(<-9          <-8(<-1         )<-3          <-2)<-7         <-6) ->10

with each number connecting to the next number in the sequence. And entering on the outside of the outermost circle would teleport it to the opposite side of the circle and have it move out.

if you could help with this much, I'd be very very VERY grateful, and I already think this is a lot to ask for. I'll try to figure out how to get the "circles"(although they aren't drawn and visible) to rotate so the teleporting isn't always to the complete opposite side.

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #786 on: January 06, 2012, 06:32:46 PM »
http://pastebin.com/KPcC0m10

Do I need to do a function of something? And in the script, do I need to include it as a function?
" Borders are Borders. They were meant to be manipulated and mistreated. "

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #787 on: January 06, 2012, 06:44:22 PM »
Hey, I'm new here, and I've recently gotten into Danmakufu. Still sort of a beginner, but I was wondering how you would do this:

-> 3 concentric circles, their center is the center of the game screen (NOT drawn, just so you know)
->bullets spawned from the middle, doesn't really matter atm
->when bullets collide with a point on a circle, they teleport to another point, and have the delay cloud thing where they come out (I know you can use Obj_SetPosition to reposition the bullet, but I can't figure out the delay cloud. Do I have to make an object effect?)

Not much of an expert, but if you want to shoot bullets from the middle, try doing it like this:
Code: [Select]
CreateShot01( GetCenterX, GetCenterY, speed, angle + ( OPTIONAL ) ascent, graphic, delay );
If your MainLoop style scripting, make 5 or less separate frames like this :
Code: [Select]
frame1++;
frame2++;
frame3++;
frame4++;
frame5++;

Include one of them with an infinite loop or just make the frame equal to a very high number for it too continue to 0
Code: [Select]
if( frame1 == 1300 ) { frame1 = 20 }
If your tasking, maybe try Objs or something, because I am not skilled with tasking.

( I will not know if this works though, ) If you want to make a delay cloud, use an image of a cloud, and set it as Obj_Effect. Same as using Yuyuko's Fan or Marisa's MasterSpark.

I really don't know what is a concentric circle, sorry >.>

Sorry I couldn't be much help, I am not a tasking person <.<
« Last Edit: January 07, 2012, 11:38:14 PM by ReiRei »
" Borders are Borders. They were meant to be manipulated and mistreated. "

Trickysticks

  • What am I? TRICKYSTEAKS I AM!
  • A stick of the tricky variety.
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #788 on: January 06, 2012, 08:56:04 PM »
I can't be much help either, but for the delay cloud I'd say use ObjShot_SetDelay(id, frames).
Interested in playing some boss fights I made? Have Danmakufu? Then check out my Danmakufu creations!

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #789 on: January 06, 2012, 09:08:08 PM »
ReiRei, it's quite alright. I know that it's already a lot to ask for. Concentric circles are basically circles that share the same center point. And umm yeah... I use tasks xD

It's not really the bullets that are the problem(well, technically, it IS...). It doesn't really matter how they're shot right now, all I want is 3 concentric circles that teleport the bullets to other points.

Here's what I have right now(hypothetical, I don't really know how to put it into code :\):

->The 3 circles have radii of 40 px, 90 px, and 180 px
->Bullets teleport (positions change) in a certain order(sequence posted in previous post)
->The inner and outer circles will be "rotating" clockwise, while the middle one(90 px) goes counterclockwise(which creates the effect of a more unpredictable maze of danmaku)
->the rotating will be managed frame by frame in the mainloop with a global variable?

for now, if a set of 2 circles can be made(bullets teleport from point a on Circle A to point b on Circle B, then from point a on Circle B to point b on Circle A), I can probably try to build off of it and make a third circle

@Trickysticks: Wouldn't ObjShot_SetDelay set the delay for when the bullet is created?

...unless I delete the old bullet and shoot a new object bullet in the new position? O.o

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #790 on: January 06, 2012, 09:17:17 PM »
Since I am lazy explaining ObjShot_SetDelay, I'll let the wiki help you,

Quote
ObjShot_SetDelay
Code: [Select]
2 Parameters
    1) object ID
    2) delay frames

Set how many frames of delay will be applied to the bullet. Remember that the delay of a bullet will make a "cloud" similar to the bullet's color wherever it's going to spawn. For a laser, a thinner laser will be made where the laser is going to spawn. No collision detection is preformed during the delay process, for neither bullet clouds or laser guides.

You set how many frames of delay and the delay of the bullet will make a cloud.
" Borders are Borders. They were meant to be manipulated and mistreated. "

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #791 on: January 06, 2012, 09:49:20 PM »
sorry, I had bad wording in my post... ^^" What I meant to say was that using ObjShot_SetDelay would create the cloud effect, but only when the object bullet it spawned. Unless I deleted the bullet when it teleports and spawn a new bullet in the destination, I can't use ObjShot_SetDelay for this.

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #792 on: January 06, 2012, 10:09:55 PM »
I have never tasked in my life since I cannot get the concept, but, try this:
NOTE: I really don't know if teleporting is possible on the old engine, but probably the new ph3 engine since they are making additions and drastic changes to most functions. I've tried scripting, but there is no clear English manual, so you probably want to stick to 0.12m first. Unless you get all the concepts >.>.
~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Vanish the Bullet and make it reappear at the destination
2. Make a small delay for the bullet
3. Redo

Sorry if it doesn't work out well. I never tasked but I have ideas of Obj Functions so. Maybe you can try it.  You might wanna ask Helepolis or Drake for that matter though. Sorry ^^;

" Borders are Borders. They were meant to be manipulated and mistreated. "

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #793 on: January 06, 2012, 10:53:40 PM »
sorry, I had bad wording in my post... ^^" What I meant to say was that using ObjShot_SetDelay would create the cloud effect, but only when the object bullet it spawned. Unless I deleted the bullet when it teleports and spawn a new bullet in the destination, I can't use ObjShot_SetDelay for this.

Why not do exactly that? That was actually what I was going to suggest. It may not be the same bullet, but it will look like it is as long as the bullet graphic is the same. Otherwise, there is no way to get the delay cloud. Unless of course you made your own, but that seems unnecessarily annoying.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #794 on: January 06, 2012, 10:55:59 PM »
http://pastebin.com/KPcC0m10
Do I need to do a function of something? And in the script, do I need to include it as a function?
No, and yes. You just use #include_function "filename" wherever you want those variables initialized. In most cases, it's fine at the very beginning of script_enemy_main. All that script does is allocate numbers to be used as shot IDs to more descriptive variables. It doesn't actually change anything in the script, just makes it easier to name bullet types.

->The 3 circles have radii of 40 px, 90 px, and 180 px
->Bullets teleport (positions change) in a certain order(sequence posted in previous post)
->The inner and outer circles will be "rotating" clockwise, while the middle one(90 px) goes counterclockwise(which creates the effect of a more unpredictable maze of danmaku)
->the rotating will be managed frame by frame in the mainloop with a global variable?
Haha, I find it pretty funny how you guys are like "what? Making a new bullet?!?!" when that's exactly what you would want to do. In any case, I'm still not exactly sure how you're going about this. Do all the points on each "wall" teleport the bullet on the opposite side of the next spot (plus rotation)? That sounds right so I'm going to assume that's the plan, but eh.

First thing is to make the rotation variables. All that's needed is a simple circle1=0; circle2=0; circle3=0;. You can then either directly use the MainLoop to change them or you can make an infinitely looping task that goes circle1++;circle--;circle3++; or however fast you want them to turn. Since it's a circle that's turning, you don't have to define anything other than those angle offsets.
Next is the bullet behaviour. You can make it really easy if you realize you only need to keep track of the time, instead of checking collision and such. You're going to want another task to fire and handle each bullet, and all you need is an angle parameter for now. Inside the task, make an angle=a; variable or something to keep track of the current angle because it'll be altered later. The task will fire a simple CreateShotA with whatever angle you want. You set it up just like any other shot, but you add SetShotKillTime(id, frames); before you fire it. That will just tell the bullet to delete itself after that time (or more relevantly, at that radius). After the FireShot call, loop a yield for the same amount of frames as the kill time. Then, you just write down another CreateShotA in the exact same fashion, except the difference is that the firing angle is now, according to your layout, angle+circle2. The shot location is also now middlex+cos(angle+180+circle2)*90, middley+sin(angle+180+circle2)*90. You similarly repeat this process until you've hit all the walls, every time you need to change the firing angle to angle=angle+circle#; and the "shot location" angle to angle+180+circle#. Also going to mention that the "entry" circle isn't important, it seems to be just the "exit" circle that you use.

Sorry if that was a bit complicated, but hopefully you get the idea.
« Last Edit: January 06, 2012, 11:00:15 PM by Drake »

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

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #795 on: January 06, 2012, 10:59:52 PM »
Well, now, thanks for telling me I don't need to do a function thing Drake. Just wanna make sure I ain't missing anything before I release it. And, that is complicated. One such as I cannot get the concept, but hopefully he'll get it.
" Borders are Borders. They were meant to be manipulated and mistreated. "

AJS

  • Danmakufu Scripter
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #796 on: January 07, 2012, 07:38:32 AM »
I'm making a Mamizou script, and for her spells, I'm spamming (destructible) familiars across the screen.  Here, I came across a few problems...

1) After a while, the familiars just altogether stop spawning.  I'm guessing this is because the game engine is being overburdened by too many familiars, since apparently the familiars don't go away when they leave the screen.  This is a problem I've been dealing with for a while, but how can I get a familiar to self-terminate without causing weird crap to happen or causing that little explosion sound that familiars typically make when they're destroyed?  I've experimented with a few methods, but it often results in really weird things, such as all on-screen familiars disappearing, or the boss itself disappearing.

2) As I mentioned, the familiars can be destroyed by shooting.  However, each time I shot a familiar down, all other familiars on-screen turned invisible for a split second.  How can I fix this?

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #797 on: January 07, 2012, 08:35:05 AM »
1) After a while, the familiars just altogether stop spawning.  I'm guessing this is because the game engine is being overburdened by too many familiars, since apparently the familiars don't go away when they leave the screen.  This is a problem I've been dealing with for a while, but how can I get a familiar to self-terminate without causing weird crap to happen or causing that little explosion sound that familiars typically make when they're destroyed?  I've experimented with a few methods, but it often results in really weird things, such as all on-screen familiars disappearing, or the boss itself disappearing.
Judging by the familiars using the generic enemy explosion sound, they're just enemies being spawned. VanishEnemy deletes the enemy without any trace, so by setting boundaries you should be able to limit the active enemies. In any case, that's bound to be extremely processing-heavy, and I would suggest investing in a different method if possible.

2) As I mentioned, the familiars can be destroyed by shooting.  However, each time I shot a familiar down, all other familiars on-screen turned invisible for a split second.  How can I fix this?
This is an issue with your drawing code, possibly due to using DeleteGraphic and then an immediate LoadGraphic. In any case, they're being connected somehow and without knowing how the drawing works it's hard to pinpoint the problem.


EDIT:
>dude with danmakufu problem
>no idea what caused problem
>guess solution at random
>fix everything like a boss
« Last Edit: January 07, 2012, 09:48:27 AM by Drake »

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

AJS

  • Danmakufu Scripter
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #798 on: January 07, 2012, 09:12:14 AM »
Judging by the familiars using the generic enemy explosion sound, they're just enemies being spawned. VanishEnemy deletes the enemy without any trace, so by setting boundaries you should be able to limit the active enemies. In any case, that's bound to be extremely processing-heavy, and I would suggest investing in a different method if possible.
This is an issue with your drawing code, possibly due to using DeleteGraphic and then an immediate LoadGraphic. In any case, they're being connected somehow and without knowing how the drawing works it's hard to pinpoint the problem.
Thanks!  I tried messing around with VanishEnemy again (which caused said weird stuff for me in the past, probably due to improper use), and I finally managed to get it to work.  As for the drawing code, I just removed "DeleteGraphic" from the familiars' scripts and it's fine now.

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #799 on: January 07, 2012, 02:45:46 PM »
Haha, I find it pretty funny how you guys are like "what? Making a new bullet?!?!" when that's exactly what you would want to do. In any case, I'm still not exactly sure how you're going about this. Do all the points on each "wall" teleport the bullet on the opposite side of the next spot (plus rotation)? That sounds right so I'm going to assume that's the plan, but eh.

[insert big explanation here]

Sorry if that was a bit complicated, but hopefully you get the idea.

Thankyouthankyouthankyouthankyouthankyou! What you said worked perfectly, although I used Object bullets instead (for some reason SetShotDataA is more confusing to me for this than Obj bullets).

Code: [Select]
  task TeleportDanmaku(x,y,v,dir,graphic,delay,tcount){
    let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
if(tcount==5){
  wait(40/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2(90*sin(angle-rotate),90*cos(angle-rotate))+180;
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+90*cos(angle-rotate),GetCenterY+90*sin(angle-rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==4){
  wait(50/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2(90*sin(angle-rotate),90*cos(angle-rotate));
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+90*cos(angle-rotate),GetCenterY+90*sin(angle-rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==3){
  wait(90/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2(180*sin(angle+rotate),180*cos(angle+rotate))+180;
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+180*cos(angle+rotate),GetCenterY+180*sin(angle+rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==2){
  wait(90/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2(40*sin(angle+rotate),40*cos(angle+rotate));
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+40*cos(angle+rotate),GetCenterY+40*sin(angle+rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==1){
  wait(50/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2(180*sin(angle+rotate),180*cos(angle+rotate));
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+180*cos(angle+rotate),GetCenterY+180*sin(angle+rotate),v,dir,graphic,delay,tcount-1);}
  }

That's what I made from this, and basically you enter all the basic values required for an object bullet as well as a tcount, which specifies how many teleportations are left for that bullet. When it is shot, depending on the tcount, it will wait a different time and then shoot another bullet at a certain position relative to the variable "rotate", with a tcount 1 less than it was this time. Doing it this way, I can create shots at other positions with different starting tcounts to follow the same teleport sequence.

...Did I overcomplicate the code? I feel like there's a ton of unnecessary stuff in there...


Oh and another question: for some reason, when I put that task almost anywhere else in the script(namely, lower than it's current place) I made, an error occurs O.o Do you know why this is? Also, why are all the tasks and stuff at the bottom one huge folder or whatever it is when I open it up in Notepad++? Does this have something to do with why it isn't working?

http://pastebin.com/b4iFu9Zn

EDIT: Oops! Forgot to say that you can comment out the drawing stuff (namely the include function the functions related to it). And I've put the TeleportDanmaku at the bottom to show you what I mean(it's supposed to be where the comment that says it works is).

EDIT2: Weird... now it works... ._." Nevermind about the problem then! But still, what's with the folder thingies in my script? All the tasks seem to be a part of 1 big folder or something... o-o
« Last Edit: January 07, 2012, 06:40:22 PM by xForeverFanaticx »

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #800 on: January 07, 2012, 08:45:59 PM »
You can... simplify that ifstatement. Lemme type it out.

Code: [Select]
  task TeleportDanmaku(x,y,v,dir,graphic,delay,tcount){
    let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y); Obj_SetSpeed(obj,v); Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic); ObjShot_SetDelay(obj,delay);
ascent(i in 0..5) { if(tcount==1+i){
  wait([50,90,90,50,40][i]/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2([180,40,180,90,90][i]*sin(angle-rotate),[180,40,180,90,90][i]*cos(angle-rotate))+180;
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+[180,40,180,90,90][i]*cos(angle-rotate),GetCenterY+[180,40,180,90,90][i]*sin(angle-rotate),v,dir,graphic,delay,tcount-1);
} }
  }
« Last Edit: January 07, 2012, 08:50:09 PM by alt-kyuu-kyuu »

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #801 on: January 07, 2012, 11:07:48 PM »
You can... simplify that ifstatement. Lemme type it out.

Code: [Select]
  task TeleportDanmaku(x,y,v,dir,graphic,delay,tcount){
    let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y); Obj_SetSpeed(obj,v); Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic); ObjShot_SetDelay(obj,delay);
ascent(i in 0..5) { if(tcount==1+i){
  wait([50,90,90,50,40][i]/v);
  angle=Obj_GetAngle(obj)+180;
  dir=atan2([180,40,180,90,90][i]*sin(angle-rotate),[180,40,180,90,90][i]*cos(angle-rotate))+180;
  Obj_Delete(obj);
  TeleportDanmaku(GetCenterX+[180,40,180,90,90][i]*cos(angle-rotate),GetCenterY+[180,40,180,90,90][i]*sin(angle-rotate),v,dir,graphic,delay,tcount-1);
} }
  }

Hmm... Does this factor in the fact that sometimes rotate is added and sometimes subtracted? And that only sometimes 180 is added to dir to make it aimed at the center?

EDIT: Just tested it in the script, it doesn't factor those in. (although I should've noticed, since I didn't see anything with +rotate or without +180 xD)

EDIT2: I think I'll just use that and alter it a bit to suit my needs. I need to learn arrays better... >.< also, array values can be called that way? O.o It looks so simple and obvious, but I never knew you could just type up an array and do that...
« Last Edit: January 08, 2012, 02:13:39 AM by xForeverFanaticx »

TraceTheKriken

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #802 on: January 08, 2012, 03:34:17 PM »
How do I create object laser that reflects from walls (I want each shot reflect only once, not infinitely). I found a object laser help page on touhou wiki but that created still lasers, I want a moving one

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #803 on: January 08, 2012, 04:43:27 PM »
CreateLaser01 moves. Sp does CreateLaserC if you want curvy ones. For reflecting, I am having the same problem.
" Borders are Borders. They were meant to be manipulated and mistreated. "

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #804 on: January 08, 2012, 05:02:26 PM »
CreateLaser01 or any of the CreateLaser series won't allow you to bounce the laser. You're going to need an object laser for that. The reason it doesn't move is that Obj_SetSpeed doesn't work on object lasers for some reason. You have to manually move the laser by constantly using Obj_SetPosition to move the laser.

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #805 on: January 08, 2012, 08:29:09 PM »
Okay... hmm... let's see...

EDIT: If you want a better bouncing effect, use the sinuate laser code at the bottom rather than the regular laser code up here.

-Use ObjLaser functions
-Can't use Obj_SetSpeed,so must use Obj_SetPosition continuously
-Need to bounce laser off of walls once

Okay, let's do this:

Code: [Select]
function ObjLaser_Create(x, y, angle, length, width, graphic, delay){
  let obj = Obj_Create(OBJ_LASER);
  Obj_SetPosition(obj, x, y);
  //Obj_SetSpeed is skipped because it is ignored by laser objects.
  Obj_SetAngle(obj, angle);
  ObjLaser_SetLength(obj, length);
  ObjLaser_SetWidth(obj, width);
  ObjShot_SetGraphic(obj, graphic);
  ObjShot_SetDelay(obj, delay);
  return obj;
}

Use the above for making an object laser and put the obj id value into a variable, code snippet is thanks to Blargel :3
Don't forget to use ObjLaser_SetSource to turn off the base source thingy.

Code: [Select]
task ObjLaser_SetSpeed(id, v){
  while(!Obj_BeDeleted(id)){
    Obj_SetPosition(id,Obj_GetX(id)+v*cos(Obj_GetAngle(id)),Obj_GetY(id)+v*sin(Obj_GetAngle(id)));
    yield;}
}

Use the obj id variable from before to use this above snippet for speed and movement.

Code: [Select]
task Obj_Bounce(id){
  while(!Obj_BeDeleted(id)){
    if(Obj_GetX(id)<=GetClipMinX||Obj_GetX(id)>=GetClipMaxX){Obj_SetAngle(id,180-Obj_GetAngle(id)); return;}
    if(Obj_GetY(id)<=GetClipMinY||Obj_GetY(id)>=GetClipMaxY){Obj_SetAngle(id,360-Obj_GetAngle(id)); return;}
    yield;}
}

This would bounce the laser(er, any object, actually) once. If you want it to bounce an infinite number of times, remove the "return;" at the end of each if statement.

I feel like a curvy laser would have a better effect of bouncing, since it leaves a tail behind it. With this one, the laser suddenly snaps around when it "bounces" and changes direction.

Also, can anyone explain to ME how the angles are found using 180 for x boundaries and 360 for y boundaries? I don't get it... ._." Bouncing snippet of code was from Awe Striker.

EDIT: yeah, I just tested, a sinuate laser looks MUCH better than this. Use the sinuate laser create code by Blargel:

Code: [Select]
function ObjSinuateLaser_Create(x, y, speed, angle, length, width, graphic, delay){
  let obj = Obj_Create(OBJ_SINUATE_LASER);
  Obj_SetPosition(obj, x, y);
  Obj_SetSpeed(obj, speed);
  Obj_SetAngle(obj, angle);
  ObjSinuateLaser_SetLength(obj, length);
  ObjSinuateLaser_SetWidth(obj, width);
  ObjShot_SetGraphic(obj, graphic);
  ObjShot_SetDelay(obj, delay);
  return obj;
}

Ignore my setspeed code, and use the bounce code from before. Just remember, sinuate lasers' length is based on its speed and the length value you give it, so if you want a short one moving slow, give it a small length value. If you want a long one moving slow, a large length value. Fast and long laser would be lower length value. Fast and short laser would be a very low length value.
« Last Edit: January 08, 2012, 08:37:16 PM by xForeverFanaticx »

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #806 on: January 08, 2012, 08:46:58 PM »
How do you do CreateShotFromScript? Man, that is a dumbass question >.>
" Borders are Borders. They were meant to be manipulated and mistreated. "

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #807 on: January 08, 2012, 09:03:27 PM »
How do you do CreateShotFromScript? Man, that is a dumbass question >.>
I think it's similar to how you would make a bomb for a player? you need to put in a "script_" thingy after your script_enemy_main or whatever, although I'm not sure what the script is called... script_shot maybe? anyway, get that right, and then leave a space after that and name the script(you use that name to call the script in CreateShotFromScript). I think the rest of the parameters are pretty self-explanatory, except maybe for the user-defined argument. The argument is basically something you include that you can call in the bullet script, and then use the value(s) from it to do special things?

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #808 on: January 08, 2012, 09:36:15 PM »
[attach=1]

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

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #809 on: January 08, 2012, 09:51:31 PM »
[attach=1]

OH. Wow... Thanks! It was really helpful!