Shape::Shape(Vector2 startingPosition) { SetName("Blocky"); SetPosition(startingPosition); _jumpTimeout = -1.0f; _onGround = true; SetColor(0.0f, 1.0f, 0.0f, 1.0f); SetDrawShape(ADS_Square); SetSize(2.0f); // SetSprite("Resources/Images/sven.png"); SetFixedRotation(true); InitPhysics(); }
CharActor::CharActor(const String& maskPath, const Vector2 size) : PhysicsActor() //, m_mask(maskPath) , m_direction(SOUTH) , m_moving(false) , m_movingNorth(false) , m_movingEast(false) , m_movingSouth(false) , m_movingWest(false) , m_movementSpeed(100.0f) //3.0f , m_idleness(0.0f) , m_idleAnim(false) //, m_isKinematic(true) { m_mask = thePixelArthGame.m_collHandler->GetBitmask(maskPath); //SetName("Arth"); //SetColor(1.0f, 1.0f, 1.0f, 1.0f); SetSize(size.X, size.Y); //_mask->setSizeInWorldUnits(size); SetDensity(1.0f); SetFriction(0.0f); SetRestitution(0.0f); SetIsSensor(true); SetFixedRotation(true); InitPhysics(); //_timestampArrowReleased = theWorld.GetCurrentTimeSeconds(); //ClearSpriteInfo(); SetSprite("Resources/Images/animations/chars/arth/stand/lookAroundDown/lookAroundDown_00.png"); theSwitchboard.SubscribeTo(this, "CameraChange"); theSwitchboard.SubscribeTo(this, "UpArrowPressed"); theSwitchboard.SubscribeTo(this, "DownArrowPressed"); theSwitchboard.SubscribeTo(this, "LeftArrowPressed"); theSwitchboard.SubscribeTo(this, "RightArrowPressed"); theSwitchboard.SubscribeTo(this, "UpArrowReleased"); theSwitchboard.SubscribeTo(this, "DownArrowReleased"); theSwitchboard.SubscribeTo(this, "LeftArrowReleased"); theSwitchboard.SubscribeTo(this, "RightArrowReleased"); ///TEST //_world = new Bitmask("Resources/Images/coll.png"); }
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(); }