Ejemplo n.º 1
0
void MoveToAction::update(float t) {
    Action::update(t);
    
    Point newPosition = PointAdd(this->origin, PointMake(this->delta.x * t, this->delta.y * t, this->delta.z * t));
    
    this->get_target()->set_position(newPosition);
}
Ejemplo n.º 2
0
	Scene::Scene()
	{
		LEAK_DETECT_INC("Scene");
		
		setRelativeAnchor(false);
		Point p = PointMake(0.5f, 0.5f);
		setAnchor(p);
		setContentSize(Director::sharedDirector()->winSize());
	}
Ejemplo n.º 3
0
HRESULT selectScene::init()
{
	IMAGEMANAGER->addFrameImage("button", "image/button.bmp", 64, 32, 2, 1, true, 0xff00ff);
	IMAGEMANAGER->addFrameImage("select", "image/select.bmp", 42, 21, 1, 1, false, false);

	_decreaseAngle = new button;
	_decreaseAngle->init("button", CENTERX - 100, CENTERY + 100, PointMake(0, 0), PointMake(0, 0), onDcrsAngleButton);
	_increaseAngle = new button;
	_increaseAngle->init("button", CENTERX + 100, CENTERY + 100, PointMake(1, 0), PointMake(1, 0), onIncrsAngleButton);

	_decreaseMaxSpd = new button;
	_decreaseMaxSpd->init("button", CENTERX - 100, CENTERY + 150, PointMake(0, 0), PointMake(0, 0), onDcrsMaxSpdButton);
	_increaseMaxSpd = new button;
	_increaseMaxSpd->init("button", CENTERX + 100, CENTERY + 150, PointMake(1, 0), PointMake(1, 0), onIncrsMaxSpdButton);

	_select = new button;
	_select->init("select", CENTERX, CENTERY + 200, PointMake(0, 0), PointMake(0, 0), onSelectButton);

	_battle.x = WINSIZEX / 4;
	_carrier.x = WINSIZEX / 4 * 2;
	_phoenix.x = WINSIZEX / 4 * 3;
	_battle.y = _carrier.y = _phoenix.y = CENTERY;

	_battle.angle = _carrier.angle = _phoenix.angle = 0.f;
	_battle.maxSpd = _carrier.maxSpd = _phoenix.maxSpd = 0.f;

	_battle.image = IMAGEMANAGER->findImage("battle");
	_carrier.image = IMAGEMANAGER->findImage("carrier");
	_phoenix.image = IMAGEMANAGER->findImage("phoenix");

	_battle.rc = RectMakeCenter(_battle.x, _battle.y, _battle.image->getFrameWidth(), _battle.image->getFrameHeight());
	_carrier.rc = RectMakeCenter(_carrier.x, _carrier.y, _carrier.image->getFrameWidth(), _carrier.image->getFrameHeight());
	_phoenix.rc = RectMakeCenter(_phoenix.x, _phoenix.y, _phoenix.image->getFrameWidth(), _phoenix.image->getFrameHeight());

	_battle.image->setFrameX(_battle.angle / PI8);
	_carrier.image->setFrameX(_carrier.angle / PI16);
	_phoenix.image->setFrameX(_phoenix.angle / (PI / 13));

	return S_OK;
}