Example #1
0
Experience::Experience(Vector2 pos)
{
	_setUp = false;
	_speed = 10.0f;
	SetIsSensor(true); // make not collidable
	pos.X += (MathUtil::RandomFloat(1.0) - 0.5);
	pos.Y += (MathUtil::RandomFloat(1.0) - 0.5);
	SetSprite("Resources/Images/exp1.png");
	SetPosition(pos);
	SetDrawShape(ADS_Square);
	SetSize(MathUtil::RandomFloat(0.4) + 0.2);
	//SetColor(0, 0.8, 0);
	Untag("Enemy");
	Tag("Experience");
	InitPhysics();
	theWorld.Add(this);
}
Example #2
0
CharActor::CharActor(const String& maskPath, const Vector2 size)
	: PhysicsActor()
	//, m_mask(maskPath)
	, m_direction(SOUTH)
	, m_moving(false)
	, m_movingNorth(false)
	, m_movingEast(false)
	, m_movingSouth(false)
	, m_movingWest(false)
	, m_movementSpeed(100.0f)	//3.0f
	, m_idleness(0.0f)
	, m_idleAnim(false)
	//, m_isKinematic(true)
{
    m_mask = thePixelArthGame.m_collHandler->GetBitmask(maskPath);
	//SetName("Arth");
	//SetColor(1.0f, 1.0f, 1.0f, 1.0f);
	SetSize(size.X, size.Y);
	//_mask->setSizeInWorldUnits(size);

	SetDensity(1.0f);
	SetFriction(0.0f);
	SetRestitution(0.0f);
	SetIsSensor(true);
	SetFixedRotation(true);
	InitPhysics();
	
	//_timestampArrowReleased = theWorld.GetCurrentTimeSeconds();

	//ClearSpriteInfo();
	SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png");

	theSwitchboard.SubscribeTo(this, "CameraChange");
	theSwitchboard.SubscribeTo(this, "UpArrowPressed");
	theSwitchboard.SubscribeTo(this, "DownArrowPressed");
	theSwitchboard.SubscribeTo(this, "LeftArrowPressed");
	theSwitchboard.SubscribeTo(this, "RightArrowPressed");
	theSwitchboard.SubscribeTo(this, "UpArrowReleased");
	theSwitchboard.SubscribeTo(this, "DownArrowReleased");
	theSwitchboard.SubscribeTo(this, "LeftArrowReleased");
	theSwitchboard.SubscribeTo(this, "RightArrowReleased");

	///TEST
	//_world = new Bitmask("Resources/Images/coll.png");
}