新人求助
做一个跑酷的小游戏, 玩家跳跃这边不是很理解
float fDis = m_nSpeed*delta;
float fY = this->getPositionY();
这2个不理解是什么意思
// 加速度 初始速度
:m_nAccel(-500), m_nSpeed(0), m_nState(0)
bool CPlayer::onTouchBegan(Touch *touch, Event *event)
{
m_nState++;
if (m_nState <= 2)
{
m_nSpeed = 300;
}
return true;
}
void CPlayer::update(float delta)
{
m_nSpeed += m_nAccel*delta;
float fDis = m_nSpeed*delta;
float fY = this->getPositionY();
fY += fDis;
this->setPositionY(fY);
if (m_nSpeed <0 && fY < 30)
{
m_nState = 0;
this->setPositionY(30);
}
}