public Stork(float pMaxSpeed = 200) : base("data/Stork 2.png", 5, 3, 12, false, true) { _maxSpeed = pMaxSpeed; _inputEnabled = true; SetOrigin(85f / 2, 85f / 2); _customColliderBounds = new Rectangle(13 - 85f / 2, 5 - 85f / 2, 43, 76); IsMoveEnabled = true; // _body = new AnimationSprite("data/Stork00.png", 3, 1, -1, false, false); // _body.SetOrigin(85f / 2, 85f / 2); // _body.visible = false; //AddChild(_body); // _leftWing = new AnimationSprite("data/Stork_Left_Wing.png", 3, 1, -1, false, false); // _rightWing = new AnimationSprite("data/Stork_Right_Wing.png", 3, 1, -1, false, false); // // _leftWing.SetOrigin(85f / 2, 85f / 2); // _rightWing.SetOrigin(85f / 2, 85f / 2); // // AddChild(_leftWing); // AddChild(_rightWing); }
public Door(bool pIsOneSided, string filename, int cols, int rows, int frames = -1, bool keepInCache = false, bool addCollider = true) : base(filename, cols, rows, frames, keepInCache, addCollider) { _customColliderBounds = new Rectangle(0, -54 - 20, 128, 20); _isOneSided = pIsOneSided; SetFrame(_isOneSided ? 2 : 0); }
public Image(float x, float y, float width, float height, Sprite image) : base(Mathf.Ceiling(width), Mathf.Ceiling(height), false) { bounds = new Rectangle(x, y, width, height); useSprite = true; sprite = image; Draw(); SetXY(x, y); }
public HunterCrossHairGameObject(HunterGameObject pHunter) : base("data/Hunter Crosshair00.png", 1, 1) { _hunter = pHunter; color = _startColor = 0x6acedd; //Light blue from stylesheet SetOrigin(width * 0.5f, height * 0.5f); _customColliderBounds = new Rectangle(-44 * 0.5f, -44 * 0.5f, 44, 44); }
public HunterBullet(float pSpeed = 200, float pRange = 500) : base("data/Hunter Bullet.png", 1, 1, -1, false, true) { _speed = pSpeed; _range = pRange; _lifeTime = _speed > 0 ? _range / _speed : 1000; SetOrigin(width * 0.5f, height * 0.5f); _customColliderBounds = new Rectangle(-5, -4, 10, 8); }
//------------------------------------------------------------------------------------------------------------------------ // initializeAnimFrames() //------------------------------------------------------------------------------------------------------------------------ private void initializeAnimFrames(int cols, int rows, int frames=-1) { if (frames < 0) frames = rows * cols; if (frames > rows * cols) frames = rows * cols; if (frames < 1) return; _cols = cols; _frames = frames; _frameWidth = 1.0f / (float)cols; _frameHeight = 1.0f / (float)rows; _bounds = new Rectangle(0, 0, _texture.width * _frameWidth, _texture.height * _frameHeight); _currentFrame = -1; SetFrame(0); }
public DeliveryPoint(float pX, float pY, float pWidth, float pHeight, uint pTimer) : base("data/Delivery Point.png") { _timer = pTimer; width = Mathf.Round(pWidth); height = Mathf.Round(pHeight); x = pX + width / 2f; y = pY - height + height / 2f; SetOrigin(width / 2f, height / 2f); _customColliderBounds = new Rectangle(-width * 0.25f, -height * 0.25f, width * 0.5f, height * 0.5f); // var easy = new EasyDraw(100, 100); // easy.Clear(Color.Black); // AddChild(easy); CoroutineManager.StartCoroutine(ResizeRoutine(), this); }
public Player(bool pInputEnabled = true) : base("player_base_sprite.png") { SetOriginToCenter(); objectsToCheck = new GameObject[0]; _inputEnabled = pInputEnabled; _inputEnabled = pInputEnabled; alpha = 0.0f; //Adjust a collider, based on a original image of 256x256 _customColliderBounds = new Rectangle(-95 * 0.5f * _scale, (-95 * 0.5f * _scale), 95 * _scale, 95 * _scale); _animation = new AnimationSprite("walking_animation.png", 8, 3, -1, false, false); AddChild(_animation); _animation.SetScaleXY(_scale, _scale); _animation.SetOriginToCenter(); _fog1 = new Sprite("fog.png", true, false); AddChild(_fog1); _fog1.x = -_fog1.width / 2; _fog1.y = -_fog1.height / 2; _fog2 = new AnimationSprite("anim_fog.png", 2, 1, -1, true, false); _fog1.scale = 10; AddChild(_fog2); _fog2.x = x + 1000; _deceleration = 0.9f; _currentSpeed = _walkSpeed; _rand = new Random(); _frame = 1; }
//------------------------------------------------------------------------------------------------------------------------ // initializeFromTexture() //------------------------------------------------------------------------------------------------------------------------ protected void initializeFromTexture(Texture2D texture) { _texture = texture; _bounds = new Rectangle(0, 0, _texture.width, _texture.height); setUVs(); }
public DroneGameObject(float pX, float pY, float pWidth, float pHeight, float pSpeed = 200, float pRotation = 0) : base( "data/Drone spritesheet small.png", 2, 2, 4, false, true) { _id = ++IdCounter; name = $"{this}_{_id}"; _customColliderBounds = new Rectangle(-27, -24, 53, 50); _maxSpeed = pSpeed; float originalWidth = width; float originalHeight = height; SetOrigin(0, height); float lScaleX = pWidth / width; float lScaleY = pHeight / height; SetScaleXY(lScaleX, lScaleY); x = pX; // + width / 2; y = pY; // - height + height / 2f; SetOrigin(originalWidth / 2f, originalHeight / 2f); Turn(pRotation); x = pX + Mathf.Cos(rotation.DegToRad()) * width * 0.5f; y = pY + Mathf.Sin(rotation.DegToRad()) * width * 0.5f; var pos = new Vector2(x - pX, y - pY); var perp = new Vector2(pos.y, -pos.x).Normalized; pos = perp * height * 0.5f; SetScaleXY(1, 1); x += pos.x; y += pos.y; _startPosition = new Vector2(x, y); _ledSprite = new AnimationSprite("data/Drone White Led.png", 1, 1, -1, false, false); _ledSprite.SetOrigin(width * 0.5f, height * 0.5f); _ledOffSprite = new AnimationSprite("data/Drone Gray Led.png", 1, 1, -1, false, false); _ledOffSprite.SetOrigin(width * 0.5f, height * 0.5f); _ledSprite.SetColor(0, 1f, 0); AddChild(_ledOffSprite); AddChild(_ledSprite); _droneFollowRangeCone = new DroneFollowRangeCone(this); _droneFollowRangeCone.SetColor(0.9f, 0.9f, 0); _droneFollowRangeCone.alpha = 0; AddChild(_droneFollowRangeCone); _easyDrawDebug = new EasyDraw(200, 80, false); _easyDrawDebug.SetOrigin(0, _easyDrawDebug.height * 0.5f); _easyDrawDebug.Clear(Color.Black); AddChild(_easyDrawDebug); _easyDrawDebug.TextFont("data/Gaiatype.ttf", 8); _easyDrawDebug.x = 0; _easyDrawDebug.y = -40; CoroutineManager.StartCoroutine(WaitForEnemyLoad(), this); }