Author Topic: Blargel's Danmakufu Corner (Ikareimu Revival? and Contest)  (Read 64973 times)

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Blargel's Danmakufu Corner (Ikareimu Revival? and Contest)
« on: October 26, 2009, 11:41:44 AM »


I lost the first three projects I've ever made. Sorry about that.

Extra Object Functions Library
Adds Obj_SetAcceleration, Obj_SetMaxMinSpeed, Obj_SetAngularVelocity, Obj_GetAcceleration, Obj_GetMaxMinSpeed, and Obj_GetAngularVelocity functions to your script for easier handling of objects.

ObjectShotA Library
Slow as hell and hard to understand at first glance. Only up here for the luls. Use seriously at your own risk.

Common Functions Library
A small (but hopefully growing) library of useful functions like distance, angle, etc.

Mr. McBullet
My entry to the Dead Simple contest.

Goliath Doll
I was bored.

Meiling's Punishment
My entry to the Survival Card contest

Bad Apple
Not made of bullets. Just images.

Ikareimu
A proof of concept stage for a mix of Ikaruga and Touhou.

Shoot the Bullet Engine
Barely functional and pretty hard on the processor. However, I'm pretty proud of how everything is working.

Youmu vs Utsuho
A proof of concept stage for a game where the player is always centered on the screen and everything wraps around.
« Last Edit: August 05, 2016, 06:36:53 AM by Blargel »
<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.

Thaws

  • _m廿廿m_
Re: Blargel's Danmakufu Corner
« Reply #1 on: October 26, 2009, 11:47:56 AM »
Welcome back!
I don't think I even started lurking around here when you were around, but this board is surely much more crowded than before!
You guide to the basics of danmakufu was what helped me get started on scripting danmakufu. Thanks for the guide.  :)
« Last Edit: October 26, 2009, 12:01:40 PM by Thaws »

Stuffman

  • *
  • We're having a ball!
Re: Blargel's Danmakufu Corner
« Reply #2 on: October 26, 2009, 05:20:09 PM »
Oh hey welcome back dude, I was wondering where you went off to.

Looking forward to seeing more Ikareimu progress.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner
« Reply #3 on: October 26, 2009, 05:41:08 PM »
Thanks guys. I forgot to mention, but I actually lost the file(s?) for Ikareimu with Mannosuke so I'm actually gonna have to kill my brain trying to rewrite whatever huge mathematical stuff I vaguely remember needing to write for laser absorption.

This is gonna be fun.
<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.

Nimble

  • Broken English Fox
  • Rushing toward the bullet!
    • Viewmix
Re: Blargel's Danmakufu Corner
« Reply #4 on: October 26, 2009, 06:45:24 PM »
Thank you for your tutorial. Your guide and ExPatchouli stage teach me a lot for Danmakufu script (well, with Rumia and Patcy shoot teach more about how script work in game)

ExRumia's Brilliant Knife alway drain my bomb until now... wrong move for dead end.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner
« Reply #5 on: October 26, 2009, 07:21:32 PM »
And here's a bit of work already! Cause I got bored.
Ever get tired of how Danmakufu's objects don't have Set and Get functions for acceleration, max/min speed, and angular velocity? You have to write some sort of damn custom functions to handle that crap and maybe you're too lazy to write them (Or you're relatively new to Danmakufu and are just starting with objects).

Well fear no more! Just add this script to your lib folder, include it in your scripts with #include_function "\lib\whateverYouNamedIt.txt" just before initialize, and stick Obj_UpdateObjects; somewhere in your @MainLoop where it will be run once per frame. Voila! Obj_SetAcceleration, Obj_SetMaxMinSpeed, Obj_SetAngularVelocity, and their corresponding Get functions are magically added and working like the built in Obj get and set functions!

Code: [Select]
/****************************************
* Variables                             *
****************************************/

let ObjectExtraProperties      = [];

let OBJECT_ID                  = 0;
let OBJECT_ACCEL               = 1;
let OBJECT_MAXMINSPEED         = 2;
let OBJECT_ANGULARVELOCITY     = 3;

/****************************************
* Public Functions                      *
****************************************/

function Obj_SetAcceleration(obj, accel){
  let indx = Obj_getIndex(obj);
  if(indx != -1){
    ObjectExtraProperties[indx] = [obj, accel, Obj_getMaxMinSpeedByIndex(indx), Obj_getAngularVelocityByIndex(indx)];
  }
  else{
    ObjectExtraProperties = ObjectExtraProperties ~ [[obj, accel, NULL, 0]];
  }
}

function Obj_SetMaxMinSpeed(obj, speed){
  let indx = Obj_getIndex(obj);
  if(indx != -1){
    ObjectExtraProperties[indx] = [obj, Obj_getAccelerationByIndex(indx), speed, Obj_getAngularVelocityByIndex(indx)];
  }
  else{
    ObjectExtraProperties = ObjectExtraProperties ~ [[obj, 0, speed, 0]];
  }
}

function Obj_SetAngularVelocity(obj, angularVelocity){
  let indx = Obj_getIndex(obj);
  if(indx != -1){
    ObjectExtraProperties[indx] = [obj, Obj_getAccelerationByIndex(indx), Obj_getMaxMinSpeedByIndex(indx), angularVelocity];
  }
  else{
    ObjectExtraProperties = ObjectExtraProperties ~ [[obj, 0, NULL, angularVelocity]];
  }
}

function Obj_GetAcceleration(obj){
  return Obj_getAccelerationByIndex(Obj_getIndex(obj));
}

function Obj_GetMaxMinSpeed(obj){
  return Obj_getMaxMinSpeedByIndex(Obj_getIndex(obj));
}

function Obj_GetAngularVelocity(obj){
  return Obj_getAngularVelocityByIndex(Obj_getIndex(obj));
}

function Obj_Update(){
  let len = length(ObjectExtraProperties);
  descent(i in 0..len){
    if(Obj_BeDeleted(ObjectExtraProperties[i][OBJECT_ID])){
      ObjectExtraProperties = erase(ObjectExtraProperties, i);
    }
    else{
      let obj = ObjectExtraProperties[i][OBJECT_ID];
      let accel = ObjectExtraProperties[i][OBJECT_ACCEL];
      let newSpeed = Obj_GetSpeed(obj) + accel;
      let angularVelocity = ObjectExtraProperties[i][OBJECT_ANGULARVELOCITY];
      let newAngle = Obj_GetAngle(obj) + angularVelocity;

      if(ObjectExtraProperties[i][OBJECT_MAXMINSPEED] != NULL){
        let maxMinSpeed = ObjectExtraProperties[i][OBJECT_MAXMINSPEED];
        if((accel<0 && newSpeed<maxMinSpeed) || (accel>0 && newSpeed>maxMinSpeed)){
          newSpeed = maxMinSpeed;
        }
      Obj_SetSpeed(obj, newSpeed);
      Obj_SetAngle(obj, newAngle);
      }
    }
  }
}

/****************************************
* Private Functions                     *
****************************************/

function Obj_getIndex(obj){
  let len = length(ObjectExtraProperties);
  ascent(i in 0..len){
    if(ObjectExtraProperties[i][OBJECT_ID] == obj){
      return i;
    }
  }
  return -1;
}

function Obj_getAccelerationByIndex(indx){
  return ObjectExtraProperties[indx][OBJECT_ACCEL];
}

function Obj_getMaxMinSpeedByIndex(indx){
  return ObjectExtraProperties[indx][OBJECT_MAXMINSPEED];
}

function Obj_getAngularVelocityByIndex(indx){
  return ObjectExtraProperties[indx][OBJECT_ANGULARVELOCITY];
}

As an example, if you saved the above code in the lib folder as ExtraObjectFunctions.txt and make a script with the following code, you'll see the object bullet will have an angular velocity and acceleration with just that tiny code!

Code: [Select]
#TouhouDanmakufu
#Title[Extra Object Bullet Functions Test]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function "\lib\ExtraObjectFunctions.txt"
let count=0;
@Initialize
{
SetLife(10000);
}

@MainLoop
{
if(count == 60){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, 90);
Obj_SetSpeed(obj, 0);
ObjShot_SetGraphic(obj, RED01);
Obj_SetAcceleration(obj, 0.05);
Obj_SetMaxMinSpeed(obj, 5);
Obj_SetAngularVelocity(obj, 0.3);
}
Obj_UpdateObjects();
count++;
}

@Finalize
{
}

@DrawLoop
{
}
}

Enjoy!


EDIT1: Hmmm, I just noticed that it runs rather slowly... perhaps I should try to edit this a little to see if I can fix it.
EDIT2: Fixed a little, but still some performance issues. First code block updated.
EDIT3: Optimized as much as possible. Can handle approximately 200-300 bullets at a time without much problems. First code block updated. Please report bugs if you find any.
« Last Edit: October 27, 2009, 10:46:24 AM by Blargel »
<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.

Primula

  • EARL TYPE 222
Re: Blargel's Danmakufu Corner
« Reply #6 on: October 26, 2009, 09:51:56 PM »
Hooray you returned!

Re: Blargel's Danmakufu Corner
« Reply #7 on: October 27, 2009, 02:55:16 AM »
Hello and welcome back, sir Blargel.


Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Blargel's Danmakufu Corner
« Reply #9 on: October 27, 2009, 07:25:34 AM »
PS Curious Blargel, what made you quit the Dnh scene and actually return again? ( I hope you were still playing somewhat Touhou (UFO etc) ? )

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner
« Reply #10 on: October 27, 2009, 07:39:39 AM »
I sorta grew out of an obsession of Touhou and more into a mild interest. Truthfully, I haven't even touched UFO yet, and I haven't played SA much either. I still read some of the doujins every so often though. Now that I'm back, I plan to only be active in the Danmakufu community, but that could change. ;)

I started leaving Danmakufu behind during my first encounter of the problem I was having with Ikareimu. I was having trouble getting object bullets to behave like ShotA bullets and just gave up after a while. I came back recently because of an interest in programming. After learning some actual computer languages (not scripting languages), I wanted to see what Danmakufu was capable of and see if I was better at it than I was before.

If you're wondering, I don't feel much better at Danmakufu, but at least my code is cleaner now. I think I might understand why and when to use microthreading instead of putting everything into @MainLoop as well.
<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.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Blargel's Danmakufu Corner
« Reply #11 on: October 27, 2009, 08:05:56 AM »
Oh you should try to play SA and UFO. They are great inspirational sources for Danmakufu. Right now, Fujiwara no Mokou, Drake, Me and probably others are like fighting hard to immitate effects from the original games.

I am not a programmer genius or math genius, therefor my coding is generally poor in efficiency, though pretty tidy if I might say myself =P

Too bad we don't know eachother that well yet, but that will change perhaps. I probably entered the scene almost year ago when you were semi-active. I have played your ExPatchouli script I think.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner
« Reply #12 on: October 27, 2009, 08:28:25 AM »
I can't really get my hands on SA or UFO by legal means very easily since I'm living in China now. After getting used to American online banking systems, Chinese ones just seem really... weird and hard to use.

I'm not much of an effect person. I'm the type of guy to try to push a system to its limits just to see what's possible. Example: I made a pretty much functional turned-based RPG battle system... in Warcraft III: Frozen Throne. This was before moving on to Touhou and Danmakufu.

But yeah, looking forward to working with you and everyone else here.
<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.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Blargel's Danmakufu Corner
« Reply #13 on: October 27, 2009, 08:47:30 AM »
Your style reminds me of my younger ages with Age of Empires, Red Alert etc. I love to modify games or create news things for them.  Then I bet you also seen that dude on niconico creating Danmakufu tetris?

If you live in China, can't you like easy ship the things from Japan (should be not much to pay the shipping prices right?) I think Paletweb was still selling copies of Touhou games.

Oh pushing limits happens often, that is why I mentioned the effects. Currently I have this burning aura effect where like alot of particles are spawned to create a burning effect. It looks superb but is a huge strain on the engine :V You can see the effect on my youtube channel if you look for DoubleVla.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner
« Reply #14 on: October 27, 2009, 09:53:25 AM »
Then I bet you also seen that dude on niconico creating Danmakufu tetris?

Of course! Rather old actually, but amazing nonetheless. The guy even made different versions with versus modes and stuff. It probably even supports two players.

Quote
If you live in China, can't you like easy ship the things from Japan (should be not much to pay the shipping prices right?) I think Paletweb was still selling copies of Touhou games.

No see the issue is paying for it with PaletWeb. My American credit cards are canceled so I have to make do with Chinese thingies to pay online. But just how on Earth do I do that?

Quote
Oh pushing limits happens often, that is why I mentioned the effects. Currently I have this burning aura effect where like alot of particles are spawned to create a burning effect. It looks superb but is a huge strain on the engine :V You can see the effect on my youtube channel if you look for DoubleVla.

Bwahaha. It's always funny when the engine starts straining like that. Funny and a pain in the ass if it's something you actually need to make what you want to make. I recently put together another library which lets you make object bullets that behave like ShotA bullets. It's amazing how well it works except for the fact that the parameters you input into it is really messed up and it causes major performance loss.

What're the parameters? How about I give you an example?
Code: [Select]
let behavior = [
  [0, 1, 90, 4, 0.01, 5, RED01],
  [30, NULL, NULL, -1, 0.01, 5, RED01],
  [60, NULL, NULL, 0, 0.01, 5, RED01]
];
let obj = CreateObjectShotA(GetX, GetY, 10, behavior);
This has the same effect as
Code: [Select]
CreateShotA(0, GetX, GetY, 10);
SetShotDataA(0, 0, 1, 90, 4, 0.01, 5, RED01);
SetShotDataA(0, 30, NULL, NULL, -1, 0.01, 5, RED01);
SetShotDataA(0, 60, NULL, NULL, 0, 0.01, 5, RED01);
FireShot(0);

Yeah... one of the parameters you pass in is a giant two-dimensional array, one element per extra SetShotDataA imitation you wanna do. And by the way, I'm not sure if you know this, but, Danmakufu is terrible at handling multi-dimensional array. If you look in the script in the library, it's a huge mess when you get to the part about trying to handle that array.



EDIT: Extra Object Functions Library optimized!
« Last Edit: October 27, 2009, 11:02:59 AM by Blargel »
<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.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Blargel's Danmakufu Corner
« Reply #15 on: October 27, 2009, 10:50:25 AM »
Hmmm we got chinese people on the forum, I think you should visit the "everything else" section and ask there. I am sure people can help out.

Oh object bullets behaving like CreateShotA. I noticed your code but currently at my work so got little material or time to work with now. I will look into it when I am at home.

And I have never been a fond of arrays in danmakufu :V I only use them if I have to.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner
« Reply #16 on: October 27, 2009, 11:24:15 AM »
Lol, you wanna take a look at it? Might as well put it up, but I warn you, it's very slow. Almost to the point of being ridiculous and unusable. Actually it probably is unusable considering how few bullets it can handle.


Anyway, I present to you all, the ObjectShotA.

Code: [Select]
/************************************************************
 *
 *  Constants
 *
 ***********************************************************/
let OBJ_ID                      = 0;
let OBJ_START_FRAME             = 1;
let OBJ_CURRENT_BEHAVIOR        = 2;

let BEHAVIOR_DURATION             = 0;
let BEHAVIOR_VELOCITY             = 1;
let BEHAVIOR_ANGLE                = 2;
let BEHAVIOR_ANGULAR_VELOCITY     = 3;
let BEHAVIOR_ACCELERATION         = 4;
let BEHAVIOR_MAX_MIN_SPEED        = 5;
let BEHAVIOR_GRAPHIC              = 6;

let MAX_BEHAVIOR_COUNT            = 8;
/************************************************************
 *
 *  Variables
 *
 ***********************************************************/

let BehaviorShots = [];
let BehaviorShotBehaviors = [];

/************************************************************
 *
 *  Public Functions
 *
 ***********************************************************/
function CreateObjectShotA(x, y, delay, behavior){
  let obj = Obj_Create(OBJ_SHOT);
  Obj_SetPosition(obj, x, y);
  ObjShot_SetDelay(obj, delay);
 
  let startFrame = CurrentFrame();
 
  //id, starting frame, current behavior, behavior list
  let behaviorShot = [obj, startFrame, 0];

  let len = length(behavior);
  let behaviorShotBehavior = [];
  if(len < MAX_BEHAVIOR_COUNT){
    behaviorShotBehavior = behaviorShotBehavior ~ behavior;
    loop(MAX_BEHAVIOR_COUNT-len) {
      behaviorShotBehavior = behaviorShotBehavior ~ [[-1, 0, 0, 0, 0, 0, 0]];
    }
  } else if (len > MAX_BEHAVIOR_COUNT){
    ascent(i in 0..MAX_BEHAVIOR_COUNT) {
      behaviorShotBehavior = behaviorShotBehavior ~ [behavior[i]];
    }
  }

  BehaviorShots = BehaviorShots ~ [behaviorShot];
 
  BehaviorShotBehaviors = BehaviorShotBehaviors ~ [behaviorShotBehavior];

  return obj;
}

function ObjectShotA_Run(){

  let len = length(BehaviorShots);

 
  OutputDebugString(0, "len", len);
  descent(i in 0..len){
    if(Obj_BeDeleted(BehaviorShots[i][OBJ_ID])){
      BehaviorShots = erase(BehaviorShots, i);
      BehaviorShotBehaviors = erase(BehaviorShotBehaviors, i);
    }
    else{
      let behaviorShot = BehaviorShots[i];
      let behaviorShotBehavior = BehaviorShotBehaviors[i];
   
      BehaviorShot_updateState(behaviorShot, behaviorShotBehavior);
      BehaviorShot_updateAttributes(behaviorShot, behaviorShotBehavior);
    }
  } 
}


/************************************************************
 *
 *  Private Functions
 *
 ***********************************************************/
function BehaviorShot_updateAttributes(behaviorShot, behaviorShotBehavior){
  let obj = behaviorShot[OBJ_ID];
  let behaviors = behaviorShotBehavior;
  let currentBehaviorIndex = behaviorShot[OBJ_CURRENT_BEHAVIOR]; 
  let currentBehavior = behaviors[currentBehaviorIndex];

  let angularVelocity  = currentBehavior[BEHAVIOR_ANGULAR_VELOCITY];
  let acceleration     = currentBehavior[BEHAVIOR_ACCELERATION];
  let maxMinSpeed      = currentBehavior[BEHAVIOR_MAX_MIN_SPEED];

  let speed            = Obj_GetSpeed(obj);
  let angle            = Obj_GetAngle(obj);
 
  let newSpeed = speed + acceleration;
  if((acceleration > 0 && newSpeed > maxMinSpeed) || (acceleration < 0 && newSpeed < maxMinSpeed)){
    newSpeed = maxMinSpeed;
  }
  let newAngle = angle + angularVelocity;
 
  Obj_SetSpeed(obj, newSpeed);
  Obj_SetAngle(obj, newAngle);
 
}

function BehaviorShot_updateState(behaviorShot, behaviorShotBehavior){
  let obj = behaviorShot[OBJ_ID];
  let startFrame = behaviorShot[OBJ_START_FRAME];
  let timePassed = CurrentFrame() - startFrame;
  let behaviors = behaviorShotBehavior;
 
  let o = BehaviorShot_getBehaviorShotIndex(obj);

  let len = length(behaviors);
  descent(i in 0..len){
    let behavior = behaviors[i];
    let triggerTime = behavior[BEHAVIOR_DURATION];
    if( triggerTime >= 0 && timePassed - triggerTime == 0){
      BehaviorShot_setBehavior(obj, behavior);
      BehaviorShots[o] = [obj, startFrame, i];
    }
  }
}

function BehaviorShot_setBehavior(obj, behavior){
  let speed            = behavior[BEHAVIOR_VELOCITY];
  let angle            = behavior[BEHAVIOR_ANGLE];
  let graphic          = behavior[BEHAVIOR_GRAPHIC];
  if(speed != NULL){
    Obj_SetSpeed(obj, speed);
  }
  if(angle != NULL){
    Obj_SetAngle(obj, angle);
  }
  ObjShot_SetGraphic(obj, graphic);
}

function BehaviorShot_getBehaviorShotIndex(obj){
  let len = length(BehaviorShots);

  ascent(i in 0..len){
    let behaviorShot = BehaviorShots[i];
    if(behaviorShot[OBJ_ID]== obj){
      return i
    }
  }
 
  return -1
}

function BehaviorShot_getBehaviorShot(obj){
  let len = length(BehaviorShots);

  ascent(i in 0..len){
    let behaviorShot = BehaviorShots[i];
    if(behaviorShot[OBJ_ID]== obj){
      return behaviorShot;
    }
  }

  RaiseError("Can't find obj.", "BehaviorShot Error");
}

function BehaviorShot_getBehaviorShotBehavior(obj){
  let len = length(BehaviorShots);

  ascent(i in 0..len){
    let behaviorShot = BehaviorShots[i];
    if(behaviorShot[OBJ_ID]== obj){
      return BehaviorShotBehaviors[i];
    }
  }

  RaiseError("Can't find obj.", "BehaviorShot Error");
}

function debugShot(obj, i){
  let behaviorShot = BehaviorShot_getBehaviorShot(obj);
  let behaviorShotBehavior = BehaviorShot_getBehaviorShotBehavior(obj);

  OutputDebugString(1, "obj", obj);
  OutputDebugString(2, "OBJ_START_FRAME", behaviorShot[OBJ_START_FRAME]);
  OutputDebugString(3, "OBJ_CURRENT_BEHAVIOR", behaviorShot[OBJ_CURRENT_BEHAVIOR]);
 
  debugBehavior(behaviorShotBehavior[i]);
}

function debugBehavior(b){
  OutputDebugString(4, "BEHAVIOR_DURATION", b[BEHAVIOR_DURATION]);
  OutputDebugString(5, "BEHAVIOR_VELOCITY", b[BEHAVIOR_VELOCITY]);
  OutputDebugString(6, "BEHAVIOR_ANGLE", b[BEHAVIOR_ANGLE]);
  OutputDebugString(7, "BEHAVIOR_ANGULAR_VELOCITY", b[BEHAVIOR_ANGULAR_VELOCITY]);
  OutputDebugString(8, "BEHAVIOR_ACCELERATION", b[BEHAVIOR_ACCELERATION]);
  OutputDebugString(9, "BEHAVIOR_MAX_MIN_SPEED", b[BEHAVIOR_MAX_MIN_SPEED]);
  OutputDebugString(10, "BEHAVIOR_GRAPHIC", b[BEHAVIOR_GRAPHIC]);
}

To use, put it in your lib folder and include it in whatever scripts are gonna use it. Put ObjectShotA_Run(); in your @MainLoop where it will be run once per frame. The parameters are rather scary but if you think of it differently, it's actually rather similar to setting up regular ShotAs

Code: [Select]
#TouhouDanmakufu
#Title[Test]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
  #include_function ".\BehaviorShot.dnh"
  let frame = 0;

  @Initialize
  {
    SetLife(1);
  }
  @MainLoop
  {
    if (frame == 60){
      CreateBehaviorShot(GetCenterX, GetCenterY, 10, [
        [0, 5, 90, 4, -0.1, 1, 1],
        [30, NULL, NULL, -1, 0, 0, 1],
        [60, NULL, NULL, 0, 0.01, 3, 1]
      ]);
    }
    BehaviorShot_Run();
    frame++;
  }

  @Finalize
  {
  }

  @DrawLoop
  {
  }
}

As you can see, you don't need a FireShot(); as it is fired automatically for you when you call that one function. The parameters for the function are as follows:
Code: [Select]
CreateObjectShotA(starting_x, starting_y, delay, [
  [time_to_modify_behavior, speed, angle, angular_velocity, acceleration, max/min_speed, graphic]
]);
You can have up to 8 of those arrays inside the main array which correspond to up to 8 SetShotDataA functions. Don't forget the commas between the array elements in the big array.

Feel free to try to optimize this. This was the best I could do without killing Danmakufu or myself.
<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.

Re: Blargel's Danmakufu Corner
« Reply #17 on: October 27, 2009, 11:39:22 AM »
its already been said enough here, but welcome back. its good to see returning users :)

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.2 released!)
« Reply #18 on: October 28, 2009, 07:34:22 PM »
Ikareimu v0.2!



Click here to download!


DO NOT UNZIP THIS IN YOUR EXISTING DANMAKUFU SCRIPT FOLDER AS IT WILL CRASH YOUR DANMAKUFU! IT ALREADY HAS DANMAKUFU PACKAGED WITH IT!


Features/changes:
 - Bullet and laser absorption systems are now in place and just about finalized.
 - There's a pretty hard attack that I made to test all the stuff. Think you can survive long?
 - The shield now looks like... well... a shield. It's also slightly bigger.
 - The shield now deactivates for a split second when you change colors.
    * YOU CAN GET HIT WHILE IT IS DOWN!!
    * This is to prevent spamming 'c' from absorbing anything that comes in absorption range.

Controls are pretty much the same as any other Touhou game, except you press 'c' to change colors. For those who never heard of or played Ikaruga, you will absorb bullets that are the same color as you and can switch between the two colors freely.

To do list:
 - Make a Ikareimu-specific player character.
 - Make the Ikaruga chaining scoring system.
 - Make a game!


Feedback is always welcome!
« Last Edit: November 18, 2009, 06:27:04 AM by Blargel »
<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.

Solais

  • Developer fairy
  • is working for a game developer now.
Re: Blargel's Danmakufu Corner (Ikareimu v0.2 released!)
« Reply #19 on: October 28, 2009, 08:30:51 PM »
I can't say how awesome this Ikareimu code is (and that holyshititshard pattern reminded me Ikaruga's 4th boss). I wanted to see it for a while, but I somewhat disappointed as I expected to see a code what enables you to switch characters in game. Anyway, it's a really excellent stuff and a math n00b like me can only stare in awe.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.2 released!)
« Reply #20 on: October 29, 2009, 07:17:20 AM »
[...]I expected to see a code what enables you to switch characters in game[...]

You can't change characters in a script. The closest you can do to imitate that is to make a player script that holds all the players you wanna switch between. The easiest way to handle the switching in the Ikareimu script would be to change the bullet properties themselves like I did and change which sprite is drawn on the character at the same time via common data.

Actually, with the way I plan to design it, the character script should change the common data and all the other scripts will read the common data, but since I don't have an Ikareimu character script yet, the spellcard script is calling the color and shield functions in its place for now.
<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.

Solais

  • Developer fairy
  • is working for a game developer now.
Re: Blargel's Danmakufu Corner (Ikareimu v0.2 released!)
« Reply #21 on: October 29, 2009, 01:08:03 PM »
You can't change characters in a script. The closest you can do to imitate that is to make a player script that holds all the players you wanna switch between. The easiest way to handle the switching in the Ikareimu script would be to change the bullet properties themselves like I did and change which sprite is drawn on the character at the same time via common data.

Actually, with the way I plan to design it, the character script should change the common data and all the other scripts will read the common data, but since I don't have an Ikareimu character script yet, the spellcard script is calling the color and shield functions in its place for now.

Hmm, when I've learned enough I'll look into it. I never learned any programming ever so I'm a n00b in these areas. Anyway, it was just an old idea of mine for a Touhou game where you can collect weapons like in old-school shmups instead of choosing the shot type when you start the game. And a scoring system based on that idea, like score multipliers for how much you've changed weapon to another and stuff.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.2 released!)
« Reply #22 on: October 29, 2009, 02:54:07 PM »
Hmm, when I've learned enough I'll look into it. I never learned any programming ever so I'm a n00b in these areas. Anyway, it was just an old idea of mine for a Touhou game where you can collect weapons like in old-school shmups instead of choosing the shot type when you start the game. And a scoring system based on that idea, like score multipliers for how much you've changed weapon to another and stuff.

Yeah, you'll have to put all data for the different "weapons" in a single character script. Your idea is very doable with Danmakufu, but when you get around to it, have fun scripting the items in. I'm not so sure how that's done (bullet objects? effect objects?) and thank god Ikaruga doesn't have items to collect so there's less for me to worry about.
<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.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.2 released!)
« Reply #23 on: October 31, 2009, 09:32:08 PM »
Ikareimu v0.3!



Click here to download!


DO NOT UNZIP THIS IN YOUR EXISTING DANMAKUFU SCRIPT FOLDER AS IT WILL CRASH YOUR DANMAKUFU! IT ALREADY HAS DANMAKUFU PACKAGED WITH IT!


Features/changes:
 - Player character added.
 - Extra effect added to shield when it changes colors.
 - New system display! (Not all parts of the system work yet though)
 - Another new attack starring Marisa.

Controls are pretty much the same as any other Touhou game, except you press 'c' to change colors. For those who never heard of or played Ikaruga, you will absorb bullets that are the same color as you and can switch between the two colors freely.

To do list:
 - Give the Ikareimu character the ability to actually fire lasers. (Try bombing with at least one bar to see what happens for now. :3)
 - Make the Ikaruga chaining scoring system.
 - Make the system interface display chaining information.
 - Figure out 3D backgrounds (though I may skip this part).
 - Make a game!


Feedback is always welcome, and of course, please report any bugs you find!
Also, if anyone is interested, here's a list of things you can help me with.
« Last Edit: November 18, 2009, 06:26:51 AM by Blargel »
<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.

Solais

  • Developer fairy
  • is working for a game developer now.
Re: Blargel's Danmakufu Corner (Ikareimu v0.3 released!)
« Reply #24 on: October 31, 2009, 09:47:15 PM »
Awesome! You're gonna recreate Ikaruga from scratch?

Also: Pew Pew!

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.3 released!)
« Reply #25 on: October 31, 2009, 09:56:53 PM »
To be exact, I plan to recreate the Ikaruga engine. Then, anyone using Danmakufu and my library will be able to create Ikaruga-style games.

Of course, I plan to make a game with it too.
<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.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.3 released!)
« Reply #26 on: November 02, 2009, 02:17:50 PM »
Okay, this is just such a hilariously bad yet functional work around that I just had to share it with whoever cares. First, the problem I had:

In Ikareimu, bullet collision detection in regards to absorption is handled by the enemy who fired the said bullet. The only problem was, it was all handled in the @MainLoop. Once the enemy died, the @MainLoop stopped running and any leftover bullets that the enemy fired wouldn't be absorbed, which would definitely confuse players.

The work around? Make the enemy stop running its attack and drawing functions when its life was 100 or lower, but make it still run the Ikareimu bullet absorption system. After a while, it kills itself without a trace, making the player not even notice that it wasn't really killed until just then. The resulting framework for an enemy looks so ridiculous. Here it is:

Code: [Select]
script_enemy_main {
#include_function "lib\Ikareimu\Enemy.dnh"
// Following two variables are part of a work around. Have them at all times.
let autoDeathCounter = 600;
let FinalizeRun = false;

let count=0;
@Initialize {
EnemySystem_Initialize;

// Set the life to how much health you would like the enemy to have plus 100.
// This is a work around for an issue Danmakufu cannot address easily.
SetLife(101);
}

@MainLoop {

// This if statement is the "real" @MainLoop. Sorry, but this is part of the
// work around mentioned above.
if(GetLife > 100){
count++;
}
// End of "real" @MainLoop

if(GetLife < 100){

// This if statement is the "real" @Finalize. Yup. Part of the work around.
if(!FinalizeRun){
FinalizeRun = true;
// Things like visual and sound effects during death must be handled manually here.
}
// End of "real" @Finalize.

autoDeathCounter-=1;
if(autoDeathCounter == 0){
VanishEnemy;
}
}

EnemySystem_Run;
}

@Finalize {
EnemySystem_Finalize;
}

@DrawLoop {

// This if statement is the "real" @DrawLoop.
if(GetLife > 100){
}
// End of "real" @Drawloop.

}
}
« Last Edit: November 02, 2009, 02:20:08 PM by Blargel »
<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.

Re: Blargel's Danmakufu Corner (Ikareimu v0.3 released!)
« Reply #27 on: November 02, 2009, 05:23:34 PM »
So I guess bombs and homing shots fuck everything over? Though I can see a work around for homing shots (Josette Y comes to mind), bombs will still kill off enemies. Actually, make the workaround number be 10000, at least then bombs wont kill off the enemy. Also, to spare some processing power (I guess), you could have an if(GetEnemyShotCount<1 && GetLife<10000){ VanishEnemy; } statement, to kill off the enemy if there are no bullets left on the screen to handle.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.3 released!)
« Reply #28 on: November 02, 2009, 05:41:43 PM »
So I guess bombs and homing shots fuck everything over? Though I can see a work around for homing shots (Josette Y comes to mind), bombs will still kill off enemies.
Yeah, but if you're making Ikaruga-style gameplay with my library, you'll almost definitely be using the player character specific functions I built in as well which handles the homing lasers specifically for this workaround. And I'd hope you'd remember to restrict the usable players for your scripts to only your Ikaruga-style player character.

Quote
Actually, make the workaround number be 10000, at least then bombs wont kill off the enemy.
Yeah I suppose I should increase it anyway.

Quote
Also, to spare some processing power (I guess), you could have an if(GetEnemyShotCount<1 && GetLife<10000){ VanishEnemy; } statement, to kill off the enemy if there are no bullets left on the screen to handle.
Though I doubt much processing power is lost from having them stay when there's nothing else to handle, that's probably a good idea still. Added.



By the way, this work around only applies to the non-boss enemies. Thankfully, it's not strange for bullets to auto-delete at the end of a boss attack so there's no bullet absorption to worry about. If I had to do the work around for bosses as well, I'd have to use a custom life bar.
<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.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Blargel's Danmakufu Corner (Ikareimu v0.4 released!)
« Reply #29 on: November 08, 2009, 12:50:52 AM »
Ikareimu v0.4!



Click here to download!


DO NOT UNZIP THIS IN YOUR EXISTING DANMAKUFU SCRIPT FOLDER AS IT WILL CRASH YOUR DANMAKUFU! IT ALREADY HAS DANMAKUFU PACKAGED WITH IT!


Features/changes:
 - Tracking lasers added!
 - Extra effects added.
 - Full (but short with no mid-boss) stage!

Controls are pretty much the same as any other Touhou game, except you press 'c' to change colors. For those who never heard of or played Ikaruga, you will absorb bullets that are the same color as you and can switch between the two colors freely.

To do list:
 - Make the Ikaruga chaining scoring system.
 - Make the system interface display chaining information.
 - Figure out 3D backgrounds (though I may skip this part).
 - Make a game!


Feedback is welcome, especially about the difficulty of the stage. It was supposed to be stage one normal mode difficulty, but it ended up becoming rather hard. Or I just suck at Ikaruga/Ikareimu. Report bugs too. That's always good. :V

EDIT: For those you can't run Danmakufu, here's a YouTube video to watch!
« Last Edit: November 18, 2009, 06:26:29 AM by Blargel »
<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.