Some sort of generic boss request.
#1
Posted 21 February 2009 - 10:21 PM
I basically want a 2x2 enemy to start out in the cyan circle, and follow the arrows, stopping for a second or 2 when it hits the yellow circle areas. Also, while moving to the circle spots it should spit out 1 or 2 different damage combos.
I'd say that it should be easy but I'd probably be lying. :\
#2
Posted 22 February 2009 - 05:49 AM
#3
Posted 22 February 2009 - 11:39 AM
Though if that's too hard or you just can't be assed doing it, fireballs should be fine.
#4
Posted 22 February 2009 - 02:11 PM
What's wrong with a scripted weapon object?
What advantages does an ffc have?
The weapon can have any graphic and be larger than 16x16
#5
Posted 22 February 2009 - 06:19 PM
EDIT- I'm doing that script, just letting you know.
EDIT2- I have the movement working right for now:
EDIT3- I've got the projectiles now.
//
//Boss for Lithium but also could be used by others.;)
//By Lucas92
//
//Set its HP with the enemy editor and set the ffc data with the freeform combo editor
//the boss constants
const int BOSS_DAMAGE = 4; //Quarters hearts
//The resting time in frames 60 frames = 1 second
const int TIME = 30;
//The attacking intervall in frames 60 frames = 1 second
const int TIME2 = 30;
//the X positions
// 2
// 1 3
// 2
const int X1 = 56;
const int X2 = 100;
const int X3 = 192;
//the Y positions
// 1
// 2 2
// 3
const int Y1 = 10;
const int Y2 = 40;
const int Y3 = 90;
//Projectiles variable
const int PROJECTILE_SPEED = 2;
const int PROJECTILE_DAMAGE = 2;
const int PROJECTILE_SOUND = 13;
// Method to move a FFC angularly based on a target location
// and speed without constant supervision
// By LinktheMaster
// Parameters
// ffc combo - The FFC to be moved
// int targetX - The target X location
// int targetY - The target Y location
// int speed - The total FFC movement speed
void angularMove(ffc combo, int targetX, int targetY, int speed)
{
// Calculate the distance to the target location
int xDis = targetX - combo->X;
int yDis = targetY - combo->Y;
int dis = Abs(xDis) + Abs(yDis);
// Calculate the speed coefficient
float d = speed / dis;
// Calculate the speeds for each direction
combo->Vx = d * xDis;
combo->Vy = d * yDis;
} // End of angularMove
//D0 : The number of the FFC in the list
//D1 : The number of the NPC in the enemy list
//D2 : The speed of the boss
ffc script BOSS
{
void run(int FFC, int NPC,int speed)
{
Waitframes(4);
ffc boss = Screen->LoadFFC(FFC);
npc ghosted = Screen->LoadNPC(NPC);
//ghosted declarations
ghosted->Extend = 3;
ghosted->TileWidth = 2;
ghosted->TileHeight = 2;
//Hitbox in pixels
ghosted->HitWidth = 32;
ghosted->HitHeight = 32;
ghosted->Damage = BOSS_DAMAGE;
//Initializing position
boss->X = X2;
boss->Y = Y1;
ghosted->X = boss->X;
ghosted->Y = boss->Y;
//Position variable
bool position[4];
//Initializing the array
position[1] = true;
position[2] = false;
position[4] = false;
//Resting time variable initialization
int counter = TIME;
int counter2 = TIME2;
int fireball = 0;
while(true)
{
//Moving routine
counter -= 1;
counter2 -= 1;
if(position[1])
{
if(counter <= 0)
{
angularMove(boss, X3, Y2, speed);
if(boss->X >= X3)
{
boss->Vx = 0;
boss->Vy = 0;
boss->X = X3;
boss->Y = Y2;
position[1] = false;
position[2] = true;
counter = TIME;
}
}
}
if(position[2])
{
if(counter <= 0)
{
angularMove(boss, X2, Y3, speed);
if(boss->X <= X2)
{
boss->Vx = 0;
boss->Vy = 0;
boss->X = X2;
boss->Y = Y3;
position[2] = false;
counter = TIME;
}
}
}
if(!position[2]&&!position[1]&&!position[4])
{
if(counter <= 0)
{
angularMove(boss, X1, Y2, speed);
if(boss->X <= X1)
{
boss->Vx = 0;
boss->Vy = 0;
boss->X = X1;
boss->Y = Y2;
position[4] = true;
counter = TIME;
}
}
}
if(position[4])
{
if(counter <= 0)
{
angularMove(boss, X2, Y1, speed);
if(boss->X >= X2)
{
boss->Vx = 0;
boss->Vy = 0;
boss->X = X2;
boss->Y = Y1;
position[1] = true;
position[4] = false;
counter = TIME;
}
}
}
if(!ghosted->isValid())
{
boss->Data = 0;
break;
}
if(counter2 <= 0)
{
Game->PlaySound(PROJECTILE_SOUND);
HomingFireball(Link->X, Link->Y, boss->X+16 , boss->Y+16);
counter2 = TIME2;
}
ghosted->X = boss->X;
ghosted->Y = boss->Y;
Waitframe();
}
}
//
//Thanks go to Gleeok on that one.
//void HomingFireball
void HomingFireball(int lx, int ly, int tx, int ty)
{
eweapon fireball;
fireball = Screen->CreateEWeapon(EW_FIREBALL);
fireball->HitWidth=16;fireball->HitHeight=16;
fireball->X=tx;fireball->Y=ty;fireball->Step= PROJECTILE_SPEED*100;fireball->Damage=PROJECTILE_DAMAGE;
fireball->Angular=true;fireball->Angle = ArcTan(lx-tx,ly-ty);
}
}
Just have to decide on what weapons he should trow.
Edited by lucas92, 02 March 2009 - 09:10 AM.
#6
Posted 28 February 2009 - 06:47 PM
Ideally it would be (boss->X+16, boss->Y+16)...
Anyone has an idea on how to do it?
#7
Posted 01 March 2009 - 01:35 AM
Well, I've updated the script but I don't really know how to create a fireball each time that "counter2==0" at an another position than (0,0).
Ideally it would be (boss->X+16, boss->Y+16)...
Anyone has an idea on how to do it?
this should do it:
eweapon e;
e->X = x; e->Y = y;
e->Angular = true;
e->Angle = angle;
}
where angle is in radians:
angle = ArcTan(lx-x,ly-y)*(PI/180); - (*homing)
or angle = RadianCos(n); would do it if you like. I prefer degrees though, so to convert just multiply the radian number by 0.01745. It's accurate enough.
Hope that helps.
Edited by Gleeok, 01 March 2009 - 01:40 AM.
#8
Posted 01 March 2009 - 08:54 AM
What is homing?
Do I place that code in the main loop or in the "counter2 <= 0" condition?
#9
Posted 01 March 2009 - 03:02 PM
It seems Gleeok has managed to implement pointers into ZScript.
#10
Posted 01 March 2009 - 07:16 PM
Also I made a mistake in my previous post, ArcTan automatically returns a radian value so there's no need to convert it. It was late when I wrote it and sorry about that, hope this clarifies it.
Here's some random bullet code pulled from Grikarugun so you can see an example of what I was referring to.
laser->HitWidth=4;laser->HitHeight=4;laser->HitXOffset=6;laser->HitYOffset=6;
laser->X=tx+32;laser->Y=ty;laser->Step=200;laser->Damage=2;laser->CSet=1;
laser->Angular=true;laser->Angle = arc1-((bullet_count+2)/10);
if(GAME_MODE>=HARD)cheat=10;
else cheat = 20;
laser = Screen->CreateEWeapon(EW_MAGIC);
laser->HitWidth=6;laser->HitHeight=6;laser->HitXOffset=5;laser->HitYOffset=5;
laser->X=tx-32;laser->Y=ty-8;laser->Step=200;laser->Damage=2;
laser->CSet=1;laser->Tile=1600;
laser->Angular=true;laser->Angle = ArcTan(lx-(tx-32),ly-(ty-8));
eweapon laser;
laser = Screen->CreateEWeapon(EW_MAGIC);
laser->HitWidth=4;laser->HitHeight=4;laser->HitXOffset=6;laser->HitYOffset=6;
laser->X=tx;laser->Y=ty;laser->Step=200;laser->Damage=2;laser->CSet=0;
laser->Angular=true;laser->Angle = ArcTan(lx-tx,ly-ty);
}
The value pointed by homing?
It seems Gleeok has managed to implement pointers into ZScript.
bool Smartass(dev &joe123) throw()
{
return true;
}
In yer fayc! :-P
PS: Everyone knows this is a pointer: "->"
Edited by Gleeok, 01 March 2009 - 07:16 PM.
#11
Posted 02 March 2009 - 09:12 AM
I've updated the boss script so I think it would be the final one.
#12
Posted 02 March 2009 - 09:14 AM
Edited by lucas92, 02 March 2009 - 09:14 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users