Ejemplo n.º 1
0
void SSGun::Update(Director &director, int timePassed) {
    float xw = -(director.InputServiceInstance().mouseX - 360) * 1.5f / 75.0f;
    this->SetCenter(SSPointMake(xw, -3.5f, 10.0f));
    
    lastShotFiredTime += timePassed;
    
    // change to if mouse down
    if (director.InputServiceInstance().isMouseDown && lastShotFiredTime > 300) {
        lastShotFiredTime = 0;
        SSBullet *bullet = new SSBullet();
        bullet->SetCenter(this->GetCenter());
        this->GetScene()->AddActor(bullet);
    }
}