当前位置: 首页>>代码示例>>C++>>正文


C++ object::GetX方法代码示例

本文整理汇总了C++中object::GetX方法的典型用法代码示例。如果您正苦于以下问题:C++ object::GetX方法的具体用法?C++ object::GetX怎么用?C++ object::GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object的用法示例。


在下文中一共展示了object::GetX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FxFireDashStop

func FxFireDashStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;
	
	target->Unstuck();
	target->SetObjectLayer(nil);
	
	target->SetAction("Jump");
	ExplosionEffect(effect.Size2, target->GetX(), target->GetY(),0,0,0);
	
	for(var o in FindObjects(Find_Distance(effect.Size2, target->GetX(), target->GetY()), Find_Func("CanBeHit", target)))
	{
		if(o->GetOwner() == target->GetOwner())
			continue;
			
		var angle = Angle(target->GetX(), target->GetY(), o->GetX(), o->GetY());
		
		o->AddFireHitEffect();
		o->Fling(Sin(angle, 8), -Cos(angle, 8) - 2);
		target->WeaponDamage(o, effect.SpellDamage2);
	}
	
	target->CastObjects(Flame, RandomX(6,8), RandomX(10,25));
	//effect.marker->RemoveObject();
	//effect.clonk->MakeHitable(true);

}
开发者ID:TheThow,项目名称:OpenClonk-Stuff,代码行数:28,代码来源:Script.c

示例2: 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;
}
开发者ID:pkern,项目名称:openclonk,代码行数:54,代码来源:HitCheck.c

示例3: SetArrowToObj

global func SetArrowToObj(object obj)
{
	if (arrow_target == obj) return 0;
  RemoveObject(FindObject(_AR1));
  CreateObject(_AR1, obj->GetX() + obj->GetDefCoreVal("Width") / 4, obj->GetY() - obj->GetDefCoreVal("Height") / 2 - 10, -1);
  arrow_target = obj;
}
开发者ID:lluchs,项目名称:ClonkMars,代码行数:7,代码来源:Script.c

示例4: AddCyclopsAI

global func AddCyclopsAI(object clonk) // somewhat hacky, but it works
{
	var effect_name = "IntCyclopsAI";
	var fx = GetEffect(effect_name, clonk);
	if (!fx) fx = AddEffect(effect_name, clonk, 1, 2);
	if (!fx || !clonk) return nil;
	
	clonk.ai = fx;

	// bin inventory
	var cnt = clonk->ContentsCount();
	fx.bound_weapons = CreateArray(cnt);
	for (var i=0; i<cnt; ++i) fx.bound_weapons[i] = clonk->Contents(i);

	// set home
	fx.home_x = clonk->GetX();
	fx.home_y = clonk->GetY();
	fx.home_dir = DIR_Left;

	// set guard range
	fx.guard_range = {
                      x = fx.home_x-AI_DefGuardRangeX,
                      y = fx.home_y-AI_DefGuardRangeY,
                      wdt = AI_DefGuardRangeX*2,
                      hgt =  AI_DefGuardRangeY*2};
                      

	fx.spray_old = {time = 0, v0 = 0, v1 = 0, reach = 0};
	fx.spray_cur = {time = 0, v0 = 0, v1 = 0, reach = 0};

	AI->SetMaxAggroDistance(clonk, AI_DefMaxAggroDistance);
	return fx;
}
开发者ID:gitMarky,项目名称:Shire.ocs,代码行数:33,代码来源:Cyclops.c

示例5: SetRight2

func SetRight2(object host)
{
	SetGraphics("Right");
	SetAction("Right", host);
	SetShape(0,0,4,32);
	SetPosition(host->GetX()+15, host->GetY()-48);
	SetSolidMask(0,0,2,32,2,0);
	SetVertexXY(0,-27-3,1+32);
	return true;
}
开发者ID:772,项目名称:openclonk,代码行数:10,代码来源:Script.c

示例6: SetBottom2

func SetBottom2(object host)
{
	SetGraphics("Bottom");
	SetAction("Bottom", host);
	SetShape(0,0,32,4);
	SetPosition(host->GetX()+13, host->GetY()+12);
	SetSolidMask(0,0,32,4);
	SetVertexXY(0,1-29,-27);
	return true;
}
开发者ID:772,项目名称:openclonk,代码行数:10,代码来源:Script.c

示例7: SetLeft

func SetLeft(object host)
{
	SetGraphics("Left");
	SetAction("Left", host);
	SetShape(0,0,4,32);
	SetPosition(host->GetX()-16, host->GetY()-16);
	SetSolidMask(0,0,2,32);
	SetVertexXY(0,1,1);
	return true;
}
开发者ID:772,项目名称:openclonk,代码行数:10,代码来源:Script.c

示例8: SetTop

func SetTop(object host)
{
	SetGraphics("Top");
	SetAction("Top", host);
	SetShape(0,0,32,4);
	SetPosition(host->GetX()-16, host->GetY()-16);
	SetSolidMask(0,0,32,4);
	SetVertexXY(0,1,1);
	return true;
}
开发者ID:772,项目名称:openclonk,代码行数:10,代码来源:Script.c

示例9: Blocked

func Blocked(object clonk)
{
	AddEffect("Blocked", this, 1, 1, this);
	Sound("Ball::ball_blocked", false, 20);
	SetRDir(20);
	var objectangle = Angle(clonk->GetX(), clonk->GetY(), GetX(), GetY());
	
	//var tangle = 2* ( (objectangle + 90)%360 - entryangle) + entryangle;
	SetVelocity(objectangle, Speed);
	Idle();
}
开发者ID:TheThow,项目名称:OpenClonk-Stuff,代码行数:11,代码来源:Script.c

示例10: SetHome

// Set the home position the Clonk returns to if he has no target
func SetHome(object clonk, int x, int y, int dir)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx || !clonk) return false;
	// nil/nil defaults to current position
	if (!GetType(x)) x=clonk->GetX();
	if (!GetType(y)) y=clonk->GetY();
	if (!GetType(dir)) dir=clonk->GetDir();
	fx.home_x = x; fx.home_y = y;
	fx.home_dir = dir;
	return true;
}
开发者ID:Meowtimer,项目名称:openclonk,代码行数:13,代码来源:Script.c

示例11: Launch

func Launch(object clonk, int x, int y)
{
	if(clonk.TimeTravelMark == nil)
	{
		clonk.TimeTravelMark = [clonk->GetX(), clonk->GetY()];
		clonk.timeposfx = AddEffect("TravelPos", clonk, 1, 1, nil, GetID(), Size);
		clonk.timeposfx.size = Size;
		clonk.timeposfx.dur = Dur;
		clonk->Sound("travel_pos", false, 30, clonk->GetOwner());
		RemoveObject();
		return 1;
	}
开发者ID:TheThow,项目名称:OpenClonk-Stuff,代码行数:12,代码来源:Script.c

示例12: FxPyritHammeringTimer

func FxPyritHammeringTimer(object c, proplist fx, int time)
{
	if (FrameCounter() < this.anim_continue_frame || c.has_sequence) return FX_OK;
	this.anim = 0;
	if (!fx.catapult) if (!(fx.catapult = FindObject(Find_ID(Catapult), Sort_Distance()))) return FX_OK;
	if ((!Random(20) && GetPlayerCount()) || this.was_walk_interrupted)
	{
		// Move between two places (only if players are joined so Pyrit stays in place for object saving)
		var new_pos = [fx.catapult->GetX()-24, fx.catapult->GetX()+26][c->GetX() < fx.catapult->GetX()];
		c->SetCommand("MoveTo", nil, new_pos, fx.catapult->GetY());
		this.anim_continue_frame = FrameCounter() + 50;
		this.was_walk_interrupted = false;
	}
开发者ID:772,项目名称:openclonk,代码行数:13,代码来源:DlgPyrit.c

示例13: FxAttack_PanicTimer

func FxAttack_PanicTimer(object c, proplist fx, int time)
{
	// Run around in random directions
	var x = c->GetX();
	if (x < 400)
		x += 200;
	else if (x > 600)
		x -= 200;
	else
		x += Random(2)*400 - 200;
	c->SetCommand("MoveTo", nil, x, 300);
	return FX_OK;
}
开发者ID:772,项目名称:openclonk,代码行数:13,代码来源:SeqAttack.c

示例14: JumpEffect

func JumpEffect(object clonk, dir)
{
	var from;
	var to;

	if (dir == "Up")
	{
		from = 50; 
		to = 130;
	}
	if (dir == "Left")
	{
		from = -30; 
		to = 50;
	}
	if (dir == "Right")
	{
		from = 130; 
		to = 210;
	}
	if (dir == "Down")
	{
		from = 230; 
		to = 310;
	}

	clonk->Sound("time_hit", false, 30);

	for(var i = from; i < to; i+=5)
	{
		var r = 10;
		var x = clonk->GetX() + Cos(i, r);
		var y = clonk->GetY() + Sin(i, r);
		
		var angle = Angle(0,0,Cos(i, r),Sin(i, r));
		
		var trailparticles =
		{
			Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(10,0),
			Rotation = angle,
			R = 255,
			G = 165,
			B = 50,
			OnCollision = PC_Bounce(),
		};
	
		CreateParticle("Lightning", x, y, Cos(i, r), Sin(i, r), 10, trailparticles);
	}
}
开发者ID:TheThow,项目名称:OpenClonk-Stuff,代码行数:50,代码来源:Script.c

示例15: ControlUse

func ControlUse(object clonk, x, y)
{
	var objdef = clonk.ObjectSpawnDefinition;
	
	
	if (objdef == Marker)
	{
		var marker = clonk->PlaceNewMarker();
		if (marker) marker->SetPosition(clonk->GetX() + x, clonk->GetY() + y);
	}
	else
	{
		clonk->CreateObject(objdef, x, y);
	}
	
	Sound("UI::Click", true, nil, clonk->GetOwner());
}
开发者ID:ckanibal,项目名称:openclonk,代码行数:17,代码来源:Script.c


注:本文中的object::GetX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。