public FlappyBirdMainGameScene(string _name) : base(_name) { FlappyBirdProperties.Init(); SEObject background = new SEObject("background"); background.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("background-day")); background.GetComponent().GetTransformComponent().SetSize(SEProperties.GetGameWindowWidth(), SEProperties.GetGameWindowHeight()); background.GetComponent().GetSpriteComponent().SetLayerDepth(1.0f); AddChild(background); bird = new Bird(); AddChild(bird); obstacleManager = new ObstacleManager(); AddChild(obstacleManager); Ground ground = new Ground(); AddChild(ground); AddChild(FlappyBirdProperties.GetScoreLabel()); AddChild(FlappyBirdProperties.GetHighScoreLabel()); AddChild(FlappyBirdProperties.GetTextLabel()); }
public SESequentialChangeSprite(float _delay) { spriteList = new List <Texture2D>(); currentIndex = 0; SetAction(GetNextSprite); obj = null; delay = _delay; lastAction = DateTime.Now; }
private void CreateNewGroundPart() { SEObject groundPart = new SEObject("ground"); groundPart.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("base")); groundPart.GetComponent().GetTransformComponent().SetPosition(xPositionLastPart, FlappyBirdProperties.GetGroundHeigth()); groundPart.GetComponent().GetTransformComponent().SetSize(SEProperties.GetGameWindowWidth(), (int)(SEProperties.GetGameWindowHeight() - FlappyBirdProperties.GetGroundHeigth())); groundPart.GetComponent().GetTransformComponent().SetRectangle(new Rectangle((int)xPositionLastPart, (int)FlappyBirdProperties.GetGroundHeigth(), SEProperties.GetGameWindowWidth(), (int)(SEProperties.GetGameWindowHeight() - FlappyBirdProperties.GetGroundHeigth()))); groundPart.GetComponent().GetSpriteComponent().SetLayerDepth(0.0f); groundPart.GetComponent().GetTransformComponent().SetSpeed(4f); AddChild(groundPart); }
public Obstacle() : base("obstacle") { float shift = SEProperties.GetRandomizer().Next(0, 80); component.GetTransformComponent().SetSpeed(5.0f); bool isTopHigher = SEProperties.GetRandomizer().Next(0, 100) > 50 ? true : false; if (isTopHigher) { topHeight += shift; bottmoHeight -= shift; } else { topHeight -= shift; bottmoHeight += shift; } SEObject top = new SEObject("top"); top.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("pipe-green")); top.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() + 50, 0); top.GetComponent().GetTransformComponent().SetSize(width, topHeight); top.GetComponent().GetTransformComponent().SetSpeed(5.0f); top.GetComponent().GetSpriteComponent().SetEffect(SpriteEffects.FlipVertically); top.GetComponent().GetSpriteComponent().SetLayerDepth(1.0f); SEObject bottom = new SEObject("bottom"); bottom.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("pipe-green")); bottom.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() + 50, SEProperties.GetGameWindowHeight() - bottmoHeight); bottom.GetComponent().GetTransformComponent().SetSize(width, bottmoHeight); bottom.GetComponent().GetTransformComponent().SetSpeed(5.0f); bottom.GetComponent().GetSpriteComponent().SetLayerDepth(1.0f); AddChild(top); AddChild(bottom); isActive = true; }
public void SetObject(SEObject _obj) { obj = _obj; }