BOSS ideas

betterbold

Member
I have any ideas about boss in 2D mod.
Please tell me how to make flying bosses like "firebrand" in Ghosts 'N Goblins.

pic upload
Bosses fry in the sky but players are on the ground.
 
Well, first thing is Firebrand must not be affected by gravity at all so you need to set subject_to_gravity 0 in his header text

Now, to make him fly in certain pattern as you described, you simply need to use this function:

Code:
void dasher( float Vx, float Vy, float Vz )
{// Dash with desired speed!
    void self = getlocalvar("self");
    int dir = getentityproperty(self,"direction");

    if(dir==0){ // Facing left?
      Vx = -Vx ;
    }

    changeentityproperty(self, "velocity", Vx, Vz, Vy); //Move!
}

Example:

@cmd dasher 2 2 0 (flies forward and up with 2 pixels per centisecond speed)
frame ...

Declare this function again to change flying speed and direction
Don't forget to stop his flight with this function again at end of his move

Setting this flight pattern is easy, the tough part is setting his AI which decides when he'll fly like this and when he's attacking
 
But of course, I use scripts for players too :D
In fact, I'm making a mod with flying players right now
Though, unlike other entities, scripts for players are different to allow better control
 
Well if you don't care about animation, this function is good enough to fly:

void keyfly(float V)
{// Move hero if direction button is pressed
      void self = getlocalvar("self");
      int iPIndex = getentityproperty(self,"playerindex"); //Get player index
      int a = getentityproperty(self,"a"); //Get player's altitude
float xdir = 0;
float ydir = 0;

      if (playerkeys(iPIndex, 0, "moveleft")){// Left is pressed?
  xdir = -V;
} else if(playerkeys(iPIndex, 0, "moveright")){// Right is pressed?
  xdir = V;
      }

if(playerkeys(iPIndex, 0, "moveup") && (a <= 360)){// Up is pressed?
  ydir = V;
} else if(playerkeys(iPIndex, 0, "movedown") && (a >= 0)){// Down is pressed?
  ydir = -V;
      }

changeentityproperty(self, "velocity", xdir, 0, ydir);
}

Usage example:

anim idle
loop 1
delay 2
offset ...
bbox ...
        @cmd    keyfly 1
frame ...
        @cmd    keyfly 1
frame ...
        @cmd    keyfly 1
frame ...
        @cmd    keyfly 1
frame ...
        @cmd    keyfly 1
frame ...

Of course, you need to disable gravity before using this :)
 
Ah sorry, betterbold, I forgot about reaction cases
Anyways, the question is what would you like character to have when hit while flying? there are 3 options:
1. Fall to ground and flies up in RISE animation
2. Knocked back couple pixels without losing altitude
3. Fall down couple pixels then continue flying

(not sure why he didn't just link this :P)

Cause I thought we are discussing flying in 2D mod not in 3D one :)

Flying in that demo is different than flying in 2D. That demo demonstrates how to remain in air after jumping. While floating in air, there's no way to fly higher but there's a way to lose some altitude though
 
I simply reactivate gravity in PAIN animation for some time before stopping and deactivate gravity. Here's an example:

anim pain
delay 10
offset 32 65
        @cmd    degravity 0
        @cmd    dasher -1 0 0 # push back a little
frame data/chars/rode/fly1.png
frame data/chars/rode/fly2.png
frame data/chars/rode/fly3.png #
frame data/chars/rode/fly1.png
frame data/chars/rode/fly2.png
        @cmd    dasher 0 0 0
        @cmd    degravity 1
frame data/chars/rode/fly3.png #
frame data/chars/rode/fly1.png
frame data/chars/rode/fly2.png
frame data/chars/rode/fly3.png
@cmd beidle
frame data/chars/rode/fly1.png
frame data/chars/rode/fly2.png
frame data/chars/rode/fly3.png

Do you have all functions quoted here?
 
That depends. I use this flying scripts on character for shooter mod which doesn't require animation change. Therefore a special function for shooting is enough for attacking

But if you need animation change, that would be more complex
 
Back
Top Bottom