forked from Mirrors/openclonk
gidl: use defense boom attack object
parent
ef27c1d760
commit
accc1b82dd
Binary file not shown.
|
@ -1,15 +0,0 @@
|
|||
[DefCore]
|
||||
id=Boomattack
|
||||
Version=7,0
|
||||
Category=C4D_Vehicle
|
||||
Width=15
|
||||
Height=27
|
||||
Offset=-7,-13
|
||||
Vertices=4
|
||||
VertexX=0,0,-6,6
|
||||
VertexY=13,-13,-5,-5
|
||||
VertexCNAT=8,4,1,2
|
||||
VertexFriction=80,60,60,60
|
||||
Rotate=1
|
||||
StretchGrowth=1
|
||||
Oversize=1
|
Binary file not shown.
|
@ -1,21 +0,0 @@
|
|||
material Boomattack
|
||||
{
|
||||
receive_shadows on
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
ambient 0.500000 0.500000 0.500000 1.000000
|
||||
diffuse 0.640000 0.640000 0.640000 1.000000
|
||||
specular 0.000000 0.000000 0.000000 1.000000 12.500000
|
||||
emissive 0.000000 0.000000 0.000000 1.000000
|
||||
texture_unit
|
||||
{
|
||||
texture boomattack.png
|
||||
tex_address_mode wrap
|
||||
filtering trilinear
|
||||
colour_op alpha_blend
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
/*--
|
||||
Boom attack
|
||||
Authors: Randrian, Newton, Sven2
|
||||
|
||||
An evil rocket which is hungry on the destruction of Gidls
|
||||
--*/
|
||||
|
||||
|
||||
/* Init */
|
||||
|
||||
public func Construction()
|
||||
{
|
||||
SetAction("Fly");
|
||||
SetComDir(COMD_None);
|
||||
var fx = AddEffect("Flight",this,150,10,this);
|
||||
fx.target = g_statue;
|
||||
FxFlightTimer(this, fx, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
public func Initialize()
|
||||
{
|
||||
SetAction("Fly");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Flight */
|
||||
|
||||
private func FxFlightTimer(object _this, effect, int time)
|
||||
{
|
||||
// Attack statue!
|
||||
var target = g_statue;
|
||||
if (!target) { DoFireworks(NO_OWNER); return FX_OK; }
|
||||
if(!(time % 10))
|
||||
{
|
||||
// Adjust angle for something similar to a parabulum towards target
|
||||
var dx = target->GetX() - GetX(), dy = target->GetY() - GetY();
|
||||
var aim_dist = 600; // at this distance, fly horizontally. when getting closer, gradually turn to direct flight into target
|
||||
var aim_dy = dy * (aim_dist - Abs(dx)) / aim_dist;
|
||||
var angle = Angle(0,0,dx,aim_dy);
|
||||
//Log("angle %d %d %d %d", angle, FlySpeed, dx, aim_dy);
|
||||
SetXDir(Sin(angle, FlySpeed), 100);
|
||||
SetYDir(-Cos(angle, FlySpeed), 100);
|
||||
SetR(angle);
|
||||
}
|
||||
|
||||
var x = -Sin(GetR(), 15);
|
||||
var y = +Cos(GetR(), 15);
|
||||
|
||||
var xdir = GetXDir() / 2;
|
||||
var ydir = GetYDir() / 2;
|
||||
CreateParticle("FireDense", x, y, PV_Random(xdir - 4, xdir + 4), PV_Random(ydir - 4, ydir + 4), PV_Random(16, 38), Particles_Thrust(), 5);
|
||||
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
|
||||
/* Contact / Explosion */
|
||||
|
||||
public func IsProjectileTarget(target,shooter) { return true; }
|
||||
public func OnProjectileHit(object shot) { return DoFireworks(shot->GetController()); }
|
||||
|
||||
public func ContactBottom() { return Hit(); }
|
||||
public func ContactTop() { return Hit(); }
|
||||
public func ContactLeft() { return Hit(); }
|
||||
public func ContactRight() { return Hit(); }
|
||||
|
||||
public func Hit() { return DoFireworks(NO_OWNER); }
|
||||
public func HitObject() { return DoFireworks(NO_OWNER); }
|
||||
|
||||
private func DoFireworks(int killed_by)
|
||||
{
|
||||
GameCallEx("OnClonkDeath", this, killed_by); // for reward
|
||||
RemoveEffect("Flight",this);
|
||||
Fireworks();
|
||||
Explode(40);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Status */
|
||||
|
||||
public func IsFlyingEnemy() { return true; }
|
||||
|
||||
local ActMap = {
|
||||
|
||||
Fly = {
|
||||
Prototype = Action,
|
||||
Name = "Fly",
|
||||
Procedure = DFA_FLOAT,
|
||||
Length = 1,
|
||||
Delay = 0,
|
||||
Wdt = 15,
|
||||
Hgt = 27,
|
||||
},
|
||||
};
|
||||
local PerspectiveR = 20000;
|
||||
local PerspectiveTheta = 25;
|
||||
local PerspectivePhi = 30;
|
||||
local FlySpeed = 100;
|
||||
local Name = "$Name$";
|
||||
local ContactCalls = true;
|
|
@ -1 +0,0 @@
|
|||
Name=Boomattack
|
|
@ -1 +0,0 @@
|
|||
Name=Boomattack
|
Binary file not shown.
Before Width: | Height: | Size: 32 KiB |
|
@ -238,7 +238,7 @@ func LaunchEnemy(proplist enemy, int xmin, int xrange, int y)
|
|||
}
|
||||
}
|
||||
// Flying AI
|
||||
if (obj->~IsFlyingEnemy())
|
||||
if (obj->~HasNoNeedForAI())
|
||||
{
|
||||
// Flying enemies all init themselves to fly at the statue at the moment
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Kampf um Gidl
|
||||
Kampf um Gidl
|
||||
|
||||
Beschützt die Statue vor immer größeren Wellen von Angreifern!
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Fight for Gidl
|
||||
Fight for Gidl
|
||||
|
||||
Protect the statue against increasingly aggressive waves of enemies.
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ func ScheduleLaunchEnemy(proplist enemy)
|
|||
// Schedules spawning of enemy definition
|
||||
// Spawn on ground or in air?
|
||||
var xmin, xmax, y;
|
||||
if (enemy.Type && enemy.Type->~IsFlyingEnemy())
|
||||
if (enemy.Type == DefenseBoomAttack)
|
||||
{
|
||||
// Air spawn
|
||||
xmin = 0;
|
||||
|
@ -452,6 +452,11 @@ public func SetNextWave(string wave_name, bool wait)
|
|||
ScheduleCall(nil, Scenario.LaunchWave, 500 + wait * 2000, 1, g_wave);
|
||||
}
|
||||
|
||||
public func GiveRandomAttackTarget(object attacker)
|
||||
{
|
||||
return g_statue;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
/* Wave and enemy definitions */
|
||||
|
||||
|
@ -494,8 +499,8 @@ func InitWaveData()
|
|||
var swordogre = { Name="$EnemyOgre$", Inventory=ogresword, Energy= 90, Bounty=100, Color=0xff805000, Skin=CSKIN_Ogre, Backpack=0, Scale=[1400,1200,1200], Speed=50 };
|
||||
var nukeogre = { Name="$EnemyOgre$", Inventory=nukekeg, Energy=120, Bounty=100, Color=0xffff0000, Skin=CSKIN_Ogre, Backpack=0, Scale=[1400,1200,1200], Speed=40, Siege=true };
|
||||
var chippie = { Type=Chippie, Bounty=30 };
|
||||
var boomattack = { Type=Boomattack, Bounty=10 };
|
||||
var boomattackf= { Type=Boomattack, Bounty=25, Speed=300 };
|
||||
var boomattack = { Type=DefenseBoomAttack, Bounty=10 };
|
||||
var boomattackf= { Type=DefenseBoomAttack, Bounty=25, Speed=300 };
|
||||
//newbie = runner;
|
||||
//newbie = runner;
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ func LaunchEnemy(proplist enemy, int xmin, int xrange, int ymin, yrange)
|
|||
}
|
||||
}
|
||||
// Flying AI
|
||||
if (obj->~IsFlyingEnemy())
|
||||
if (obj->~HasNoNeedForAI())
|
||||
{
|
||||
// Flying enemies all init themselves to fly at the statue at the moment
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue