Shape::Shape(Vector2 startingPosition) { SetName("Blocky"); SetPosition(startingPosition); _jumpTimeout = -1.0f; _onGround = true; _facingRight = true; _poweringUp = false; // int zoom = ((ShapeGameManager*)theWorld.GetGameManager())->WorldZoom; // SetSize((float)(zoom) * 0.5f, (float)(zoom) * 0.5f); SetSize(3.0f, ((3.0f * 1.1f) * (106.0f / 60.0f)) ); // SetColor(0.0f, 0.0f, 1.0f, 1.0f); SetColor(1.0f, 1.0f, 1.0f, 1.0f); // LoadSpriteFrames("Resources/Images/player_1/p1_01.png", GL_CLAMP, GL_NEAREST); // LoadSpriteFrames("Resources/Images/shapey/Shapey_01.png", GL_CLAMP, GL_NEAREST); LoadSpriteFrames("Resources/Images/Sprite_shapeyV01/Untitled-3_frame_0.png", GL_CLAMP, GL_NEAREST); // LoadSpriteFrames("Resources/Images/patch_01.png", GL_CLAMP, GL_NEAREST); SetSpriteFrame(0); // SetSprite("Resources/Images/red_texture.png"); SetDensity(0.1f); SetFriction(0.1f); SetRestitution(0.0f); SetFixedRotation(true); InitPhysics(); b2PolygonShape sensorShape; b2FixtureDef sensorFixtureDef; sensorFixtureDef.isSensor = true; sensorFixtureDef.shape = &sensorShape; sensorShape.SetAsBox((3.0f / 2), 0.5f, b2Vec2(0.0f, -(GetSize().Y * 0.5f)), 0.0f); _footSensor = GetBody()->CreateFixture(&sensorFixtureDef); _footSensor->SetUserData(this); sensorShape.SetAsBox((3.0f / 2), 0.5f, b2Vec2(0.0f, (GetSize().Y * 0.5f)), 0.0f); _headSensor = GetBody()->CreateFixture(&sensorFixtureDef); _headSensor->SetUserData(this); sensorShape.SetAsBox(0.5f, ((3.0f * 1.39f / 2) - 0.5f), b2Vec2((GetSize().X * 0.5f), 0.0f), 0.0f); _rightSensor = GetBody()->CreateFixture(&sensorFixtureDef); _rightSensor->SetUserData(this); sensorShape.SetAsBox(0.5f, ((3.0f * 1.39f / 2) - 0.5f), b2Vec2(-(GetSize().X * 0.5f), 0.0f), 0.0f); _leftSensor = GetBody()->CreateFixture(&sensorFixtureDef); _leftSensor->SetUserData(this); // SetDrawSize((float)zoom * 0.5f, (float)zoom * 0.5f); _jumpSound = theSound.LoadSample("Resources/Sounds/Jump.wav", false); _powerUpSound = theSound.LoadSample("Resources/Sounds/PowerUp.wav", false); _orbSound = theSound.LoadSample("Resources/Sounds/Picked_Coin_Echo.wav", false); // _bonkSound = theSound.LoadSample("Resources/Sounds/Bonk.wav", false); // Initialize inventory _inventory = new Inventory(); }
/** * Override from Actor::Render * Handles rendering */ void CharActor::Render() { // Variable initializations float delay = 0.1f; spriteAnimationType animType = SAT_None; int startFrame = 0; int endFrame = 0; String animName = String(); // Set animation for each movement direction if(m_moving && !m_collFlags.wall) { m_idleAnim = false; #pragma region Walk North if((m_nextPosition.Y > _position.Y) & (m_nextPosition.X == _position.X)) { if(_currentAnimName.compare("WalkUp") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/up/walkUp_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkUp"; } } #pragma endregion Walk North #pragma region Walk North-East if((m_nextPosition.X > _position.X) & (m_nextPosition.Y > _position.Y)) { if(_currentAnimName.compare("WalkUpRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/upRight/walkUpRight_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkUpRight"; } } #pragma endregion Walk North-East #pragma region Walk East if((m_nextPosition.X > _position.X) & (m_nextPosition.Y == _position.Y)) { if(_currentAnimName.compare("WalkRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/right/walkRight_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkRight"; } } #pragma endregion Walk East #pragma region Walk South-East if((m_nextPosition.X > _position.X) & (m_nextPosition.Y < _position.Y)) { if(_currentAnimName.compare("WalkDownRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/downRight/walkDownRight_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkDownRight"; } } #pragma endregion Walk South-East #pragma region Walk South if((m_nextPosition.Y < _position.Y) & (m_nextPosition.X == _position.X)) { if(_currentAnimName.compare("WalkDown") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/down/walkDown_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkDown"; } } #pragma endregion Walk South #pragma region Walk South-West if((m_nextPosition.X < _position.X) & (m_nextPosition.Y < _position.Y)) { if(_currentAnimName.compare("WalkDownLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/downLeft/walkDownLeft_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkDownLeft"; } } #pragma endregion Walk South-West #pragma region Walk West if((m_nextPosition.X < _position.X) & (m_nextPosition.Y == _position.Y)) { if(_currentAnimName.compare("WalkLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/left/walkLeft_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkLeft"; } } #pragma endregion Walk West #pragma region Walk North-West if((m_nextPosition.X < _position.X) & (m_nextPosition.Y > _position.Y)) { if(_currentAnimName.compare("WalkUpLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/upLeft/walkUpLeft_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkUpLeft"; } } #pragma endregion Walk North-West } // Set idle animation if(!m_moving || m_collFlags.wall) { m_idleness+=theWorld.GetDT(); if(m_idleness < IDLE_TIME) { if(!m_idleAnim) { switch(m_direction) { case NORTH: if(_currentAnimName.compare("LookAroundUp") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundUp/lookAroundUp_00.png"); } break; case NORTHEAST: if(_currentAnimName.compare("LookAroundUpRight") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundUpRight/lookAroundUpRight_00.png"); } break; case EAST: if(_currentAnimName.compare("LookAroundRight") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundRight/lookAroundRight_00.png"); } break; case SOUTHEAST: if(_currentAnimName.compare("LookAroundDownRight") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDownRight/lookAroundDownRight_00.png"); } break; case SOUTH: if(_currentAnimName.compare("LookAroundDown") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png"); } break; case SOUTHWEST: if(_currentAnimName.compare("LookAroundDownLeft") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDownLeft/lookAroundDownLeft_00.png"); } break; case WEST: if(_currentAnimName.compare("LookAroundLeft") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundLeft/lookAroundLeft_00.png"); } break; case NORTHWEST: if(_currentAnimName.compare("LookAroundUpLeft") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundUpLeft/lookAroundUpLeft_00.png"); } break; } } } else { m_idleness=0.0f; m_idleAnim = true; switch(m_direction) { case NORTH: if(_currentAnimName.compare("LookAroundUp") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundUp/lookAroundUp_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundUp"; } break; case NORTHEAST: if(_currentAnimName.compare("LookAroundUpRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundUpRight/lookAroundUpRight_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundUpRight"; } break; case EAST: if(_currentAnimName.compare("LookAroundRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundRight/lookAroundRight_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundRight"; } break; case SOUTHEAST: if(_currentAnimName.compare("LookAroundDownRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundDownRight/lookAroundDownRight_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundDownRight"; } break; case SOUTH: if(_currentAnimName.compare("LookAroundDown") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundDown"; } break; case SOUTHWEST: if(_currentAnimName.compare("LookAroundDownLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundDownLeft/lookAroundDownLeft_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundDownLeft"; } break; case WEST: if(_currentAnimName.compare("LookAroundLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundLeft/lookAroundLeft_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundLeft"; } break; case NORTHWEST: if(_currentAnimName.compare("LookAroundUpLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundUpLeft/lookAroundUpLeft_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundUpLeft"; } break; } } } if((_currentAnimName.compare(animName) != 0) & !IsSpriteAnimPlaying()) { PlaySpriteAnimation( delay, //amount of time between frames animType, //other options are SAT_PingPong and SAT_OneShot startFrame, //starting frame endFrame, //ending frame animName.c_str() //name of the animation so you can get the event when it finishes ); } CollidingActor::Render(); }
void CharActor::Update(float dt) { float delay = 0.1f; spriteAnimationType animType = SAT_None; int startFrame = 0; int endFrame = 0; String animName = String(); Vector2 direction = Vector2::Zero; if(m_movingNorth) { direction.Y += 1.0f; } if(m_movingEast) { direction.X += 1.0f; } if(m_movingSouth) { direction.Y -= 1.0f; } if(m_movingWest) { direction.X -= 1.0f; } direction != Vector2::Zero ? m_moving=true : m_moving=false; if(m_moving) { float angle_rad = MathUtil::AngleFromVector(direction); //bug fix along axes: direction.X = direction.X == 0 ? 0 : (m_movementSpeed*dt)*cos(angle_rad); direction.Y = direction.Y == 0 ? 0 : ((m_movementSpeed/2)*dt)*sin(angle_rad); m_idleness = 0.0f; } Vector2 newPosition = _position + direction; bool collType = false;//thePixelArthGame.m_wColl->isColliding(*m_mask, newPosition-(GetSize()/2)); //std::cout << "moving: " << m_moving << " collType: " << collType << std::endl; //bool collType = false; if(m_moving) { if((newPosition.Y > _position.Y) & (newPosition.X == _position.X)) { m_direction = NORTH; } else if((newPosition.X > _position.X) & (newPosition.Y > _position.Y)) { m_direction = NORTHEAST; } else if((newPosition.X > _position.X) & (newPosition.Y == _position.Y)) { m_direction = EAST; } else if((newPosition.X > _position.X) & (newPosition.Y < _position.Y)) { m_direction = SOUTHEAST; } else if((newPosition.Y < _position.Y) & (newPosition.X == _position.X)) { m_direction = SOUTH; } else if((newPosition.X < _position.X) & (newPosition.Y < _position.Y)) { m_direction = SOUTHWEST; } else if((newPosition.X < _position.X) & (newPosition.Y == _position.Y)) { m_direction = WEST; } else if((newPosition.X < _position.X) & (newPosition.Y > _position.Y)) { m_direction = NORTHWEST; } } if(m_moving && !collType) { m_idleAnim = false; #pragma region Walk North if((newPosition.Y > _position.Y) & (newPosition.X == _position.X)) { if(_currentAnimName.compare("WalkUp") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/up/walkUp_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkUp"; } } #pragma endregion Walk North #pragma region Walk North-East if((newPosition.X > _position.X) & (newPosition.Y > _position.Y)) { if(_currentAnimName.compare("WalkUpRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/upRight/walkUpRight_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkUpRight"; } } #pragma endregion Walk North-East #pragma region Walk East if((newPosition.X > _position.X) & (newPosition.Y == _position.Y)) { if(_currentAnimName.compare("WalkRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/right/walkRight_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkRight"; } } #pragma endregion Walk East #pragma region Walk South-East if((newPosition.X > _position.X) & (newPosition.Y < _position.Y)) { if(_currentAnimName.compare("WalkDownRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/downRight/walkDownRight_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkDownRight"; } } #pragma endregion Walk South-East #pragma region Walk South if((newPosition.Y < _position.Y) & (newPosition.X == _position.X)) { if(_currentAnimName.compare("WalkDown") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/down/walkDown_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkDown"; } } #pragma endregion Walk South #pragma region Walk South-West if((newPosition.X < _position.X) & (newPosition.Y < _position.Y)) { if(_currentAnimName.compare("WalkDownLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/downLeft/walkDownLeft_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkDownLeft"; } } #pragma endregion Walk South-West #pragma region Walk West if((newPosition.X < _position.X) & (newPosition.Y == _position.Y)) { if(_currentAnimName.compare("WalkLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/left/walkLeft_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkLeft"; } } #pragma endregion Walk West #pragma region Walk North-West if((newPosition.X < _position.X) & (newPosition.Y > _position.Y)) { if(_currentAnimName.compare("WalkUpLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/walk/upLeft/walkUpLeft_00.png"); delay = 0.1f; animType = SAT_Loop; startFrame = 0; endFrame = 5; animName = "WalkUpLeft"; } } #pragma endregion Walk North-West } /*else if(collType == 0) //make enum for collType { }*/ if(!m_moving || collType) { m_idleness+=dt; if(m_idleness < IDLE_TIME) { if(!m_idleAnim) { switch(m_direction) { case NORTH: if(_currentAnimName.compare("LookAroundUp") != 0) { ClearSpriteInfo(); _currentAnimName = ""; //CLAMPMODES: GL_CLAMP or GL_REPEAT //FILTERMODES: GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, or //GL_LINEAR_MIPMAP_LINEAR SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundUp/lookAroundUp_00.png"/*, 0, GL_CLAMP, GL_LINEAR_MIPMAP_NEAREST*/); } break; case NORTHEAST: if(_currentAnimName.compare("LookAroundUpRight") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundUpRight/lookAroundUpRight_00.png"); } break; case EAST: if(_currentAnimName.compare("LookAroundRight") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundRight/lookAroundRight_00.png"); } break; case SOUTHEAST: if(_currentAnimName.compare("LookAroundDownRight") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDownRight/lookAroundDownRight_00.png"); } break; case SOUTH: if(_currentAnimName.compare("LookAroundDown") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png"); } break; case SOUTHWEST: if(_currentAnimName.compare("LookAroundDownLeft") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDownLeft/lookAroundDownLeft_00.png"); } break; case WEST: if(_currentAnimName.compare("LookAroundLeft") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundLeft/lookAroundLeft_00.png"); } break; case NORTHWEST: if(_currentAnimName.compare("LookAroundUpLeft") != 0) { ClearSpriteInfo(); _currentAnimName = ""; SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundUpLeft/lookAroundUpLeft_00.png"); } break; } } } else { m_idleness=0.0f; m_idleAnim = true; switch(m_direction) { case NORTH: if(_currentAnimName.compare("LookAroundUp") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundUp/lookAroundUp_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundUp"; } break; case NORTHEAST: if(_currentAnimName.compare("LookAroundUpRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundUpRight/lookAroundUpRight_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundUpRight"; } break; case EAST: if(_currentAnimName.compare("LookAroundRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundRight/lookAroundRight_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundRight"; } break; case SOUTHEAST: if(_currentAnimName.compare("LookAroundDownRight") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundDownRight/lookAroundDownRight_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundDownRight"; } break; case SOUTH: if(_currentAnimName.compare("LookAroundDown") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundDown"; } break; case SOUTHWEST: if(_currentAnimName.compare("LookAroundDownLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundDownLeft/lookAroundDownLeft_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundDownLeft"; } break; case WEST: if(_currentAnimName.compare("LookAroundLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundLeft/lookAroundLeft_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundLeft"; } break; case NORTHWEST: if(_currentAnimName.compare("LookAroundUpLeft") != 0) { ClearSpriteInfo(); LoadSpriteFrames("Resources/Images/animations/chars/arth/stand/lookAroundUpLeft/lookAroundUpLeft_00.png"); delay = 0.2f; animType = SAT_OneShot; startFrame = 0; endFrame = 9; animName = "LookAroundUpLeft"; } break; } } } if((_currentAnimName.compare(animName) != 0) & !IsSpriteAnimPlaying()) { PlaySpriteAnimation( delay, //amount of time between frames animType, //other options are SAT_PingPong and SAT_OneShot startFrame, //starting frame endFrame, //ending frame animName.c_str() //name of the animation so you can get the event when it finishes ); } if(m_moving & !collType) { //_position = newPosition; //TODO: check for memory leak //GetBody()->SetLinearVelocity(b2Vec2(direction.X, direction.Y)); //ApplyForce(dt, newPosition); //BUGGY //MoveTo(newPosition, dt); } GetBody()->SetLinearVelocity(b2Vec2(direction.X, direction.Y)); Actor::Update(dt); }