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()); }
protected override void Initialize() { base.Initialize(); #if DEBUG SEResourcesManager.LoadSprite(Content, @"UI\PNG\yellow_panel"); SEResourcesManager.LoadSprite(Content, @"Debug\debug"); SEResourcesManager.LoadSprite(Content, @"Debug\debug_2"); SEResourcesManager.LoadSprite(Content, @"Debug\red_border"); SEResourcesManager.LoadSprite(Content, @"Debug\circle_red"); #endif SEResourcesManager.LoadSprite(Content, "yellowbird-downflap"); SEResourcesManager.LoadSprite(Content, "yellowbird-midflap"); SEResourcesManager.LoadSprite(Content, "yellowbird-upflap"); SEResourcesManager.LoadSprite(Content, "background-day"); SEResourcesManager.LoadSprite(Content, "pipe-green"); SEResourcesManager.LoadSprite(Content, "base"); SEResourcesManager.LoadSprite(Content, @"UI\PNG\blue_button00"); SEResourcesManager.LoadFont(Content, "PixelFontScore"); SEResourcesManager.LoadFont(Content, "PixelFontText"); SEResourcesManager.LoadFont(Content, "ButtonText"); SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_die"); SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_hit"); SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_point"); SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_swooshing"); SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_wing"); FlappyBirdMainGameScene flappyBirdScene = new FlappyBirdMainGameScene("flappyBirdScene"); SESceneManager.AddScene(flappyBirdScene); SESceneManager.LoadScene(flappyBirdScene.GetName()); }
public SECircleColliderComponent() : base() { name = "circleColliderComponent"; #if DEBUG circleSprite = SEResourcesManager.GetSpriteByName(@"Debug\circle_red"); UpdateRectangle(); #endif }
static void Main() { SEResourcesManager.Init(); SESceneManager.Init(); using (var game = new FlappyBirdCore()) game.Run(); }
public SEObject(string _name) { name = _name; isEnable = true; childs = new List <SEObject>(); component = new SEComponent(); dontDestroyOnLoad = false; #if DEBUG showBorder = false; border = SEResourcesManager.GetSpriteByName(@"Debug\red_border"); #endif }
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 static void Init() { score = 0; highScore = SerializationSystem.GetValue <int>("highScore.json"); isBirdFly = false; isGameWaiting = true; highScoreLabel = new SELabel(SEResourcesManager.GetFontByName("PixelFontScore")); highScoreLabel.GetComponent().GetFontComponent().SetText(highScore.ToString()); highScoreLabel.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() / 2, SEProperties.GetGameWindowHeight() / 8); scoreLabel = new SELabel(SEResourcesManager.GetFontByName("PixelFontScore")); scoreLabel.GetComponent().GetFontComponent().SetText(score.ToString()); scoreLabel.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() / 2, SEProperties.GetGameWindowHeight() / 20); textLabel = new SELabel(SEResourcesManager.GetFontByName("PixelFontText")); textLabel.GetComponent().GetFontComponent().SetText("Tap on space to play game"); textLabel.GetComponent().GetTransformComponent().SetPosition(150, 400); groundHeigth = 450; }
public Bird() : base("bird") { scaleValue = 1.4f; isFalling = true; fallingSpeed = 5.0f; jumpSpeed = 7.0f; component.GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("yellowbird-downflap")); component.GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() / 4, SEProperties.GetGameWindowHeight() / 2); component.GetTransformComponent().SetSize(component.GetSpriteComponent().GetSpriteWidth(), component.GetSpriteComponent().GetSpriteHeight()); component.GetTransformComponent().SetScale(scaleValue, scaleValue); component.GetTransformComponent().SetOriginRotatePosition(component.GetSpriteComponent().GetSpriteWidth() / 2, component.GetSpriteComponent().GetSpriteHeight() / 2); component.GetTransformComponent().SetSpeed(fallingSpeed); component.GetSpriteComponent().SetLayerDepth(0.1f); SESequentialChangeSprite changeSpriteAnim = new SESequentialChangeSprite(0.1f); changeSpriteAnim.AddSprite(SEResourcesManager.GetSpriteByName("yellowbird-midflap")); changeSpriteAnim.AddSprite(SEResourcesManager.GetSpriteByName("yellowbird-upflap")); changeSpriteAnim.AddSprite(SEResourcesManager.GetSpriteByName("yellowbird-downflap")); changeSpriteAnim.SetObject(this); component.GetActionComponent().AddAction("changeSprite", changeSpriteAnim); component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_die"); component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_hit"); component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_point"); component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_swooshing"); component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_wing"); component.GetAudioSourceComponent().SetVolume(0.1f); //component.GetAudioSourceComponent().SetVolume(0.0f); component.GetCircleColliderComponent().SetRadius(component.GetSpriteComponent().GetSpriteWidth() / 2); component.GetCircleColliderComponent().SetCenterPosition(component.GetTransformComponent().GetPosition().X, component.GetTransformComponent().GetPosition().Y); }
public void AddSound(string soundName) { sounds.Add(soundName, SEResourcesManager.GetSoundByName(soundName)); }