forked from Mirrors/openclonk
FightForGidl: Boomattack enemy waves. Also map rework to be open for flying attackers.
parent
1dca9cf1b5
commit
82e15926eb
Binary file not shown.
|
@ -0,0 +1,16 @@
|
|||
[DefCore]
|
||||
id=Boomattack
|
||||
Version=7,0
|
||||
Category=C4D_Vehicle
|
||||
ContactCalls=1
|
||||
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.
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*--
|
||||
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(); 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(); }
|
||||
|
||||
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(); }
|
||||
public func HitObject() { return DoFireworks(); }
|
||||
|
||||
private func DoFireworks(int speed)
|
||||
{
|
||||
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$";
|
|
@ -0,0 +1 @@
|
|||
Name=Boomattack
|
|
@ -0,0 +1 @@
|
|||
Name=Boomattack
|
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -164,10 +164,13 @@ func Inventory_GetCarryTransform()
|
|||
return this.ExtraTransform;
|
||||
}
|
||||
|
||||
func LaunchEnemy(proplist enemy, int x, int y)
|
||||
func LaunchEnemy(proplist enemy, int xmin, int xrange, int y)
|
||||
{
|
||||
// Create enemy (usually a Clonk)
|
||||
var x = xmin+Random(xrange);
|
||||
var obj = CreateObjectAbove(enemy.Type ?? Clonk, x,y, ENEMY), clonk;
|
||||
if (!obj) return nil;
|
||||
obj->SetController(ENEMY);
|
||||
// Enemy visuals
|
||||
if (enemy.Skin)
|
||||
{
|
||||
|
@ -197,6 +200,7 @@ func LaunchEnemy(proplist enemy, int x, int y)
|
|||
obj.ActMap[action].Speed = obj.ActMap[action].Speed * enemy.Speed / 100;
|
||||
}
|
||||
obj.JumpSpeed = obj.JumpSpeed * enemy.Speed / 100;
|
||||
obj.FlySpeed = obj.FlySpeed * enemy.Speed / 100;
|
||||
}
|
||||
obj.MaxContentsCount = CustomAI.Clonk_MaxContentsCount;
|
||||
obj->MakeInvincibleToFriendlyFire();
|
||||
|
@ -234,17 +238,25 @@ func LaunchEnemy(proplist enemy, int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
// Init AI: Run towards statue
|
||||
CustomAI->AddAI(obj);
|
||||
CustomAI->SetMaxAggroDistance(obj, LandscapeWidth());
|
||||
var fx = GetEffect("AI", obj);
|
||||
if (fx) fx.vehicle = vehicle;
|
||||
if (g_statue)
|
||||
// Flying AI
|
||||
if (obj->~IsFlyingEnemy())
|
||||
{
|
||||
CustomAI->SetHome(obj, g_statue->GetX(), g_statue->GetY(), Random(2));
|
||||
CustomAI->SetGuardRange(obj, 0,0,LandscapeWidth(),LandscapeHeight()); // nowhere to run!
|
||||
CustomAI->SetEnemyData(obj, enemy);
|
||||
// CustomAI->SetGuardRange(obj, g_statue->GetX()-200, g_statue->GetY()-50, 400, 100);
|
||||
// Flying enemies all init themselves to fly at the statue at the moment
|
||||
}
|
||||
else
|
||||
{
|
||||
// Init AI: Run towards statue
|
||||
CustomAI->AddAI(obj);
|
||||
CustomAI->SetMaxAggroDistance(obj, LandscapeWidth());
|
||||
var fx = GetEffect("AI", obj);
|
||||
if (fx) fx.vehicle = vehicle;
|
||||
if (g_statue)
|
||||
{
|
||||
CustomAI->SetHome(obj, g_statue->GetX(), g_statue->GetY(), Random(2));
|
||||
CustomAI->SetGuardRange(obj, 0,0,LandscapeWidth(),LandscapeHeight()); // nowhere to run!
|
||||
CustomAI->SetEnemyData(obj, enemy);
|
||||
// CustomAI->SetGuardRange(obj, g_statue->GetX()-200, g_statue->GetY()-50, 400, 100);
|
||||
}
|
||||
}
|
||||
// Remember this clonk to end wave when all enemies have been killed
|
||||
g_spawned_enemies[GetLength(g_spawned_enemies)] = obj;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -24,13 +24,6 @@ func InitializeObjects()
|
|||
g_doorright.StaticSaveVar = "g_doorright";
|
||||
g_doorright->SetAutoControl();
|
||||
|
||||
var Flagpole0012 = CreateObjectAbove(Flagpole, 676, 369);
|
||||
Flagpole0012->SetCategory(C4D_StaticBack);
|
||||
Flagpole0012->MakeInvincible();
|
||||
var Flagpole0007 = CreateObjectAbove(Flagpole, 582, 369);
|
||||
Flagpole0007->SetCategory(C4D_StaticBack);
|
||||
Flagpole0007->MakeInvincible();
|
||||
|
||||
CreateObjectAbove(Rock, 312, 713);
|
||||
CreateObjectAbove(Rock, 353, 679);
|
||||
CreateObjectAbove(Rock, 894, 707);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[Head]
|
||||
Icon=36
|
||||
Title=FightForGidl
|
||||
Version=6,0
|
||||
Version=7
|
||||
Difficulty=120
|
||||
NoInitialize=true
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ func InitializePlayer(int plr, int iX, int iY, object pBase, int iTeam)
|
|||
Scoreboard->Init([{key = "relaunchs", title = Rule_Restart, sorted = true, desc = true, default = "", priority = 75},
|
||||
{key = "score", title = Nugget, sorted = true, desc = true, default = "0", priority = 100}]);
|
||||
}
|
||||
for (var flagpole in FindObjects(Find_ID(Flagpole), Find_Owner(NO_OWNER))) flagpole->SetOwner(plr);
|
||||
for (var stonedoor in FindObjects(Find_ID(StoneDoor), Find_Owner(NO_OWNER))) stonedoor->SetOwner(plr);
|
||||
g_relaunchs[plr] = MAX_RELAUNCH;
|
||||
g_scores[plr] = 0;
|
||||
|
@ -78,19 +77,17 @@ private func TransferInventory(object from, object to)
|
|||
|
||||
func JoinPlayer(plr, prev_clonk)
|
||||
{
|
||||
var relaunch_target = FindObject(Find_ID(Flagpole), Sort_Random()),x,y;
|
||||
if (relaunch_target)
|
||||
{ x = relaunch_target->GetX(); y = relaunch_target->GetY()+20; }
|
||||
else
|
||||
{ x = LandscapeWidth()/2; y = LandscapeHeight()/2-100; }
|
||||
var spawn_idx = Random(2);
|
||||
if (prev_clonk && g_statue) spawn_idx = (prev_clonk->GetX() > g_statue->GetX());
|
||||
var x=[494,763][spawn_idx],y = 360;
|
||||
var clonk = GetCrew(plr);
|
||||
if (clonk)
|
||||
{
|
||||
clonk->SetPosition(x,y);
|
||||
clonk->SetPosition(x,y-10);
|
||||
}
|
||||
else
|
||||
{
|
||||
clonk = CreateObjectAbove(Clonk, x,y+10, plr);
|
||||
clonk = CreateObjectAbove(Clonk, x,y, plr);
|
||||
clonk->MakeCrewMember(plr);
|
||||
}
|
||||
SetCursor(plr, clonk);
|
||||
|
@ -177,10 +174,25 @@ func LaunchWave(int wave)
|
|||
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())
|
||||
{
|
||||
// Air spawn
|
||||
xmin = 0;
|
||||
xmax = 550;
|
||||
y = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmin = xmax = 0;
|
||||
y = 509;
|
||||
}
|
||||
// Spawn either only enemy or mirrored enemies on both sides
|
||||
var side = enemy.Side;
|
||||
if (!side) side = WAVE_SIDE_LEFT | WAVE_SIDE_RIGHT;
|
||||
if (side & WAVE_SIDE_LEFT) ScheduleCall(nil, CustomAI.LaunchEnemy, Max(enemy.Interval,1), Max(enemy.Num,1), enemy, 10, 529);
|
||||
if (side & WAVE_SIDE_RIGHT) ScheduleCall(nil, CustomAI.LaunchEnemy, Max(enemy.Interval,1), Max(enemy.Num,1), enemy, 1190, 509);
|
||||
if (side & WAVE_SIDE_LEFT) ScheduleCall(nil, CustomAI.LaunchEnemy, Max(enemy.Interval,1), Max(enemy.Num,1), enemy, 10 + xmin, xmax - xmin, y);
|
||||
if (side & WAVE_SIDE_RIGHT) ScheduleCall(nil, CustomAI.LaunchEnemy, Max(enemy.Interval,1), Max(enemy.Num,1), enemy, 1190 - xmax, xmax - xmin, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -347,6 +359,7 @@ 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 };
|
||||
var boomattack = { Type=Boomattack };
|
||||
//newbie = runner;
|
||||
//newbie = runner;
|
||||
|
||||
|
@ -360,6 +373,8 @@ func InitWaveData()
|
|||
new amazon { Delay= 30, Num= 3, Interval=10, Side = WAVE_SIDE_LEFT }
|
||||
]}, { Name = "Explosive", Enemies = [
|
||||
new flintstone { Num=10, Interval=20 }
|
||||
]}, { Name = "Boomattack", Enemies = [
|
||||
new boomattack { Num=10, Interval=70 }
|
||||
]}, { Name = "Suicidal", Enemies = [
|
||||
new suicide { Num= 2, Interval= 5 },
|
||||
new flintstone { Delay= 15, Num= 5, Interval= 5 },
|
||||
|
@ -380,6 +395,8 @@ func InitWaveData()
|
|||
new flintstone { Num=20, Interval=15 },
|
||||
new nukeogre { Num= 2, Interval=99 },
|
||||
new amazon { Delay= 50, Num= 6, Interval=10 }
|
||||
]}, { Name = "Supreme Boomattack", Enemies = [
|
||||
new boomattack { Num=30, Interval=10 }
|
||||
]}, { Name = "Alien invasion", Enemies = [
|
||||
new bowman { Delay=260, Num= 3, Interval= 5 },
|
||||
new chippie { Num=10, Interval=10 },
|
||||
|
@ -390,6 +407,7 @@ func InitWaveData()
|
|||
new swordman { Delay= 10 },
|
||||
new amazon { Delay= 12 },
|
||||
new nukeogre { Delay= 14 },
|
||||
new boomattack { Delay= 15 },
|
||||
new swordogre { Delay= 20 },
|
||||
new artillery { Delay= 21 },
|
||||
new flintstone { Delay= 22 },
|
||||
|
@ -403,6 +421,7 @@ func InitWaveData()
|
|||
new nukeogre { Delay= 60, Num= 2, Interval=50 },
|
||||
new bigswordman { Delay=103, Num= 3, Interval=30 },
|
||||
new amazon { Delay= 10, Num= 5, Interval=10 },
|
||||
new boomattack { Delay= 40, Num=20, Interval=20 },
|
||||
new flintstone { Num=20, Interval=10 },
|
||||
new bowman { Delay= 8, Num= 5, Interval=40 },
|
||||
new suicide { Delay= 25, Num=10, Interval=20 },
|
||||
|
|
Loading…
Reference in New Issue