forked from Mirrors/openclonk
windmill: use defense boom attack object
parent
18a313c962
commit
ef27c1d760
Binary file not shown.
|
@ -1,16 +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
|
||||
IncompleteActivity=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,134 +0,0 @@
|
|||
/*--
|
||||
Boom attack
|
||||
Authors: Randrian, Newton, Sven2
|
||||
|
||||
An evil rocket which is hungry on the destruction of Windmills
|
||||
--*/
|
||||
|
||||
|
||||
/* Init */
|
||||
|
||||
public func Construction()
|
||||
{
|
||||
SetAction("Fly");
|
||||
SetComDir(COMD_None);
|
||||
var fx = AddEffect("Flight", this, 150, 10, this);
|
||||
fx.target = GetRandomWindmill();
|
||||
FxFlightTimer(this, fx, 0);
|
||||
AddEffect("FlightRotation", this, 151, 1, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Flight */
|
||||
|
||||
local rotation = 0;
|
||||
|
||||
private func FxFlightRotationTimer(object _this, effect, int time)
|
||||
{
|
||||
if (rider) return FX_Execute_Kill;
|
||||
|
||||
rotation += 2;
|
||||
if (rotation > 360) rotation = 0;
|
||||
|
||||
this.MeshTransformation = Trans_Rotate(rotation, 0,1);
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
private func FxFlightTimer(object _this, effect, int time)
|
||||
{
|
||||
// Attack!
|
||||
if (!effect.target)
|
||||
{
|
||||
if (g_lost) return DoFireworks(NO_OWNER);
|
||||
effect.target = GetRandomWindmill();
|
||||
}
|
||||
if(!(time % 10))
|
||||
{
|
||||
// Adjust angle
|
||||
var dx = effect.target->GetX() - GetX(), dy = effect.target->GetY()+50 - 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);
|
||||
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;
|
||||
}
|
||||
|
||||
/* Riding */
|
||||
|
||||
local riderattach;
|
||||
local rider;
|
||||
|
||||
public func OnMount(clonk)
|
||||
{
|
||||
rider = clonk;
|
||||
var iDir = -1;
|
||||
if (GetX() > LandscapeWidth()/2) iDir = 1;
|
||||
clonk->PlayAnimation("PosRocket", CLONK_ANIM_SLOT_Arms, Anim_Const(0));
|
||||
riderattach = AttachMesh(clonk, "main", "pos_tool1", Trans_Mul(Trans_Translate(-1000,2000*iDir,2000)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public func OnUnmount(clonk)
|
||||
{
|
||||
clonk->StopAnimation(clonk->GetRootAnimation(10));
|
||||
DetachMesh(riderattach);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
if (rider) {
|
||||
rider->SetAction("Walk");
|
||||
rider->Fling(RandomX(-5,5), -5);
|
||||
}
|
||||
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 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 |
|
@ -43,7 +43,7 @@ private func FindInventoryWeapon(fx)
|
|||
// Extra weapons
|
||||
if (fx.weapon = FindContents(Axe))
|
||||
{ fx.strategy = fx.ai.ExecuteMelee; return true; }
|
||||
if (fx.vehicle && fx.vehicle->GetID() == Boomattack)
|
||||
if (fx.vehicle && fx.vehicle->GetID() == DefenseBoomAttack)
|
||||
{ fx.weapon = FindContents(Bow); fx.strategy = fx.ai.ExecuteRanged; fx.projectile_speed = 100; fx.aim_wait = 0; fx.ammo_check = fx.ai.HasArrows; fx.ranged=true; return true; }
|
||||
if (inherited(fx, ...)) return true;
|
||||
// no weapon :(
|
||||
|
@ -445,7 +445,7 @@ func LaunchEnemy(proplist enemy, int xmin, int xrange, int ymin, yrange)
|
|||
// Create enemy (usually a Clonk)
|
||||
var x = xmin+Random(xrange);
|
||||
var y = ymin+Random(yrange);
|
||||
var obj = CreateObjectAbove(enemy.Type ?? Clonk, x,y, ENEMY), clonk;
|
||||
var obj = CreateObjectAbove(enemy.Type ?? Clonk, x,y, ENEMY);
|
||||
if (!obj) return nil;
|
||||
obj->SetController(ENEMY);
|
||||
obj->MakeCrewMember(ENEMY);
|
||||
|
@ -490,7 +490,7 @@ func LaunchEnemy(proplist enemy, int xmin, int xrange, int ymin, yrange)
|
|||
if (enemy.Vehicle == Balloon)
|
||||
{
|
||||
Balloon->ControlUseStart(obj);
|
||||
} else if (enemy.Vehicle == Boomattack) {
|
||||
} else if (enemy.Vehicle == DefenseBoomAttack) {
|
||||
vehicle = CreateObjectAbove(enemy.Vehicle, x,y+10, ENEMY);
|
||||
// Add boomattack to enemy array
|
||||
g_spawned_enemies[GetLength(g_spawned_enemies)] = vehicle;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Die Hüter der Windräder
|
||||
Die Hüter der Windräder
|
||||
|
||||
Beschützt die Windräder vor immer größeren Wellen von Angreifern!
|
||||
|
||||
Zusätzliche Waffen und Verbesserungen können im Menü auf P gekauft werden.
|
||||
Zusätzliche Waffen und Verbesserungen können im Menü auf [P] gekauft werden.
|
||||
|
||||
Ziel: Windräder hüten.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
The Guardians of Windmills
|
||||
The Guardians of Windmills
|
||||
|
||||
Protect the windmills against increasingly aggressive waves of enemies.
|
||||
|
||||
Additional weapons and upgrades can be bought via the buy menu on P.
|
||||
Additional weapons and upgrades can be bought via the buy menu on [P].
|
||||
|
||||
Goal: Guard the Windmills
|
||||
|
|
|
@ -395,6 +395,11 @@ func OnWaveCleared(int wave)
|
|||
}
|
||||
}
|
||||
|
||||
public func GiveRandomAttackTarget(object attacker)
|
||||
{
|
||||
return GetRandomWindmill();
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
/* Game end */
|
||||
|
||||
|
@ -429,9 +434,9 @@ func InitWaveData()
|
|||
var bowman = { Name="$EnemyBow$", Inventory=[Bow, Arrow], Energy=30, Bounty=10, Color=0xff80ff80, Skin=CSKIN_Steampunk, Backpack=0, IsCrew=true };
|
||||
var artillery = { Name="$EnemyArtillery$", Inventory=Firestone, Energy=10, Bounty=25, Color=0xffffff80, Skin=CSKIN_Steampunk, Backpack=0, Vehicle=Catapult, IsCrew=true };
|
||||
var ballooner = { Name="$EnemyBalloon$", Inventory=Sword, Energy=30, Bounty=15, Color=0xff008000, Skin=CSKIN_Default, Vehicle=Balloon };
|
||||
var rocketeer = { Name="$EnemyRocket$", Inventory=[Bow, Arrow], Energy=15, Bounty=15, Color=0xffffffff, Skin=CSKIN_Steampunk, Vehicle=Boomattack };
|
||||
var boomattack = { Type=Boomattack, Bounty=2 };
|
||||
var boomattackf = { Type=Boomattack, Bounty=15, Speed=300 };
|
||||
var rocketeer = { Name="$EnemyRocket$", Inventory=[Bow, Arrow], Energy=15, Bounty=15, Color=0xffffffff, Skin=CSKIN_Steampunk, Vehicle=DefenseBoomAttack };
|
||||
var boomattack = { Type=DefenseBoomAttack, Bounty=2 };
|
||||
var boomattackf = { Type=DefenseBoomAttack, Bounty=15, Speed=300 };
|
||||
|
||||
// Define composition of waves
|
||||
ENEMY_WAVE_DATA = [nil,
|
||||
|
|
Loading…
Reference in New Issue