Esempio n. 1
0
void BulletMLRunnerImpl::runAccel() {
	int term = static_cast<int>(getNumberContents(
									act_->getChild(BulletMLNode::term)));
	BulletMLNode* hnode = act_->getChild(BulletMLNode::horizontal);
	BulletMLNode* vnode = act_->getChild(BulletMLNode::vertical);

	if (bulletml_->isHorizontal()) {
		if (vnode != 0) calcAccelX(getNumberContents(vnode), term,
								   vnode->getType());
		if (hnode != 0) calcAccelY(-getNumberContents(hnode), term,
								   hnode->getType());
	}
	else {
		if (hnode != 0) calcAccelX(getNumberContents(hnode), term,
								   hnode->getType());
		if (vnode != 0) calcAccelY(getNumberContents(vnode), term,
								   vnode->getType());
	}

	act_ = 0;
}
Esempio n. 2
0
void BulletMLRunnerImpl::runChangeDirection() {
	int term = static_cast<int>(getNumberContents(
									act_->getChild(BulletMLNode::term)));
	BulletMLNode* dirNode = act_->getChild(BulletMLNode::direction);
	BulletMLNode::Type type = dirNode->getType();

	double dir;
	if (type != BulletMLNode::sequence) dir = getDirection(dirNode, false);
	else dir = getNumberContents(dirNode);

	calcChangeDirection(dir, term, type == BulletMLNode::sequence);

	act_ = 0;
}
Esempio n. 3
0
void BulletMLRunnerImpl::runChangeSpeed() {
	int term = static_cast<int>(getNumberContents(
									act_->getChild(BulletMLNode::term)));
	BulletMLNode* spdNode = act_->getChild(BulletMLNode::speed);
	BulletMLNode::Type type = spdNode->getType();

	double spd;
	if (type != BulletMLNode::sequence) spd = getSpeed(spdNode);
	else {
		spd = getNumberContents(spdNode) * (double)term
			+ runner_->getBulletSpeed();
	}
	

	calcChangeSpeed(spd, term);

	act_ = 0;
}