本文整理汇总了C++中object::GetYDir方法的典型用法代码示例。如果您正苦于以下问题:C++ object::GetYDir方法的具体用法?C++ object::GetYDir怎么用?C++ object::GetYDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::GetYDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FxHitCheckDoCheck
global func FxHitCheckDoCheck(object target, proplist effect)
{
var obj;
// rather search in front of the projectile, since a hit might delete the effect,
// and clonks can effectively hide in front of walls.
var oldx = target->GetX();
var oldy = target->GetY();
var newx = target->GetX() + target->GetXDir() / 10;
var newy = target->GetY() + target->GetYDir() / 10;
var dist = Distance(oldx, oldy, newx, newy);
var is_human = GetPlayerType(target->GetController()) == C4PT_User;
var shooter = effect.shooter;
var live = effect.live;
if (live)
shooter = target;
if (dist <= Max(1, Max(Abs(target->GetXDir()), Abs(target->GetYDir()))) * 2)
{
// We search for objects along the line on which we moved since the last check
// and sort by distance (closer first).
for (obj in FindObjects(Find_OnLine(oldx, oldy, newx, newy),
Find_NoContainer(),
Find_Layer(target->GetObjectLayer()),
Find_PathFree(target),
Sort_Distance(oldx, oldy)))
{
// Excludes
if (!obj) continue; // hit callback of one object might have removed other objects
if(obj == target) continue;
if(obj == shooter) continue;
if (is_human) {
if (obj == g_windgen1) continue;
if (obj == g_windgen2) continue;
if (obj == g_windgen3) continue;
if (obj == g_windmill) continue;
}
// Unlike in hazard, there is no NOFF rule (yet)
// CheckEnemy
//if(!CheckEnemy(obj,target)) continue;
// IsProjectileTarget or Alive will be hit
if (obj->~IsProjectileTarget(target, shooter) || obj->GetOCF() & OCF_Alive)
{
target->~HitObject(obj);
if (!target)
return;
}
}
}
return;
}
示例2: FxFireDashTimer
func FxFireDashTimer(object target, proplist effect, int time)
{
var a = effect.angle;
var x = target->GetX();
var y = target->GetY();
target->SetPosition(target->GetX() + Sin(a, 6, effect.angle_prec), target->GetY() + -Cos(a, 6, effect.angle_prec));
for(var o in FindObjects(Find_Distance(effect.Size1, x, y), Find_Func("CanBeHit", target)))
{
if(o->GetOwner() == target->GetOwner())
continue;
if(!GetEffect("DashCD", o))
{
o->Fling(0, -5);
AddEffect("DashCD", o, 20, 10);
o->AddFireHitEffect();
target->WeaponDamage(o, effect.SpellDamage1);
}
}
var chaoticspark =
{
Size = PV_Linear(1, 0),
ForceX = PV_KeyFrames(10, 0, PV_Random(-6, 6), 333, PV_Random(-6, -6), 666, PV_Random(6, 6), 1000, PV_Random(-6, 6)),
ForceY = PV_KeyFrames(10, 0, PV_Random(-8, 5), 333, PV_Random(-8, 5), 666, PV_Random(-10, 10), 1000, PV_Random(-10, 15)),
Stretch = PV_Speed(1000, 500),
Rotation = PV_Direction(),
CollisionVertex = 0,
OnCollision = PC_Die(),
R = 255,
G = PV_Linear(255,100),
B = PV_Random(0, 100),
DampingX=950,
DampingY=950,
Alpha = PV_Random(100,180),
BlitMode = GFX_BLIT_Additive
};
CreateParticle("Magic", x + RandomX(-5, 5), y + RandomX(-10, 10), RandomX(25, -25) + target->GetXDir(), RandomX(-25, 12) + target->GetYDir(), 50, chaoticspark, 4);
var firetrailparticles =
{
Prototype = Particles_FireTrail(),
Size = PV_Linear(effect.Size1,0),
BlitMode = GFX_BLIT_Additive,
OnCollision=nil,
};
CreateParticle("Fire", x, y, PV_Random(-7,7), PV_Random(-7,7), 20, firetrailparticles, 3);
var dist = Distance(x, y, effect.startx + effect.tx, effect.starty + effect.ty);
if(dist < 10 || (dist > effect.dist + 1 && time > 10))
{
effect.clonk->SetObjectLayer(nil);
return -1;
}
else
{
//Log("%d %d", dist, effect.dist);
effect.dist = dist;
}
}