public MainMenu() : base(1920, 1080) { AddGraphic(background); background.Scroll = 0; AddGraphic(corners); credits.X = 250; credits.Y = 960; credits.CenterOrigin(); AddGraphic(credits); lights.Clear(); background.Shader = new Shader(ShaderType.Fragment, "assets/shaders/water_wave.frag"); ambientLighting = new Surface(1920, 1080); lightSurface = new Surface(1920, 1080); Add(new Logo(421, 542, "assets/gfx/logo.png")); // Play/How To/Quit buttons playButton = Add(new Logo(1486, 440, "assets/gfx/play.png", 14.0f)); howToButton = Add(new Logo(1544, 540, "assets/gfx/howto.png", 14.0f)); quitButton = Add(new Logo(1480, 640, "assets/gfx/quit.png", 14.0f)); menuLight = new Light(0, 0.1f); menuLight.entity = playButton; menuLight.SetAlpha(1.0f, 0.7f); menuLight.SetAlphaSpan(1.1f); menuLight.SetOffset(175, 100); lights.Add(menuLight); }
private IEnumerator EnjoyLife() { sprite.Alpha -= 0.2f; yield return(Coroutine.Instance.WaitForFrames(4)); light = new Light(0, 0.7f); light.SetAlpha(1.0f); light.SetColor(Color.Black); light.SetRadius(650); light.entity = this; Level.darkness.Add(light); float length = 10.0f; for (float timer = 0; timer < length; timer += Game.RealDeltaTime * 0.001f) { // TODO: Put out little "explosions" sprite.Alpha -= 0.01f; yield return(0); } light.FadeOut(10.0f); yield return(Coroutine.Instance.WaitForSeconds(10.0f)); RemoveSelf(); }
IEnumerator SwimAttack() { curState = State.Swim; // Turn on lights softlight1.SetAlpha(0.6f); softlight1.FadeIn(4f); softlight2.SetAlpha(0.6f); softlight2.FadeIn(4f); float timeElapsed = 0.0f; while (timeElapsed < 5f) { if (Math.Abs(Y - 540) > 3) { Float(); } timeElapsed += Game.Instance.RealDeltaTime * 0.001f; yield return(0); } acceleration = new Vector2(0.5f, 0); X += 0.5f; while (X > 960) { yield return(0); } while (X < 52) { yield return(0); } acceleration = new Vector2(-0.5f, 0); while (velocity.X > 0) { yield return(0); } acceleration = Vector2.Zero; softlight1.FadeOut(5f); softlight2.FadeOut(5f); var num = Rand.Int(2, 3); for (int i = 0; i < num; ++i) { EnemySpawner.Instance.SpawnRandomEnemy(); } yield return(Coroutine.Instance.WaitForFrames(1)); curState = State.Idle; }
public LightningArea(float x, float y, Vector2 direction) : base(x, y, direction, 0.1f, 110, 1.7f, 1, (int)Tags.PROJECTILE, (int)Tags.PLAYERATTACK) { light = new Light(); light.SetAlpha(0.5f, 0.7f); light.SetAlphaSpan(0.3f); light.SetColor(new Color("FFD700")); light.SetColorSpan(5.0f); light.SetRadius(300, 355); light.SetRadiusSpan(0.07f); light.entity = this; Level.lights.Add(light); }
public override void Added() { base.Added(); // Create the squid's glow light light = new Light(0, 5.0f); light.SetAlpha(0.7f); light.SetColor(new Color("EF473E")); light.SetRadius(sprite.Height + 30); light.entity = this; Level.lights.Add(light); // TODO: Contact damage }
public LightningBall(float x, float y, Vector2 direction) : base(x, y, direction, 16.0f, 26, 1.2f, 5, (int)Tags.PROJECTILE, (int)Tags.PLAYERATTACK) { sprite.CenterOrigin(); Graphic = sprite; sprite.Scale = 0.3f; light = new Light(); light.SetAlpha(0.5f, 0.7f); light.SetAlphaSpan(0.5f); light.SetColor(new Color("FFD700")); light.SetColorSpan(5.0f); light.SetRadius(sprite.Width + 70, sprite.Width + 100); light.SetRadiusSpan(0.1f); light.entity = this; Level.lights.Add(light); }
public Player(float x, float y, Session session) : base(x, y) { // Assign session this.session = session; // Init bounce sounds bounce[0] = new Sound("assets/sfx/bounce1.wav"); bounce[1] = new Sound("assets/sfx/bounce2.wav"); bounce[2] = new Sound("assets/sfx/bounce3.wav"); for (int i = 0; i < 3; ++i) { bounce[i].Volume = 0.98f; } // Set up animations sprite.Add(AnimType.Go, new Anim(new int[] { 0, 1, 2, 3, 4, }, new float[] { 5.0f })); sprite.Add(AnimType.Attack, new Anim(new int[] { 7, 8, 9, 10, 11, 12, 13 }, new float[] { 4.0f })); sprite.Play(AnimType.Go); // Set up hitboxes SetHitbox(sprite.Width - 24, sprite.Height - 24, (int)Tags.PLAYER); Hitbox.CenterOrigin(); // Sprite stuff sprite.CenterOrigin(); Graphic = sprite; Layer = -1; // Initilize light light = new Light(); light.SetAlpha(0.7f); light.SetColor(new Color("879DFF"), new Color("62D8E0")); light.SetColorSpan(5.0f); light.SetRadius(sprite.Width + 30, sprite.Width + 60); light.SetRadiusSpan(5.0f); light.entity = this; Level.lights.Add(light); // TODO: Make ink slow you down }
private IEnumerator EnjoyLife() { sprite.Alpha -= 0.2f; yield return Coroutine.Instance.WaitForFrames(4); light = new Light(0, 0.7f); light.SetAlpha(1.0f); light.SetColor(Color.Black); light.SetRadius(650); light.entity = this; Level.darkness.Add(light); float length = 10.0f; for (float timer = 0; timer < length; timer += Game.RealDeltaTime * 0.001f) { // TODO: Put out little "explosions" sprite.Alpha -= 0.01f; yield return 0; } light.FadeOut(10.0f); yield return Coroutine.Instance.WaitForSeconds(10.0f); RemoveSelf(); }
public FlyingGurnard(Entity target) : base(960, 540, 20, 10.0f) { // Initialize sprite sprite.CenterOrigin(); Graphic = sprite; // Set the target this.target = target; // Set up hitbox (actually realized with the repel collider this hitbox is useless) SetHitbox(200, 200, -1); Hitbox.CenterOrigin(); Hitbox.OriginX += hitboxOffset.X; Hitbox.OriginY += hitboxOffset.Y; // Make it so the player can't touch the enemy repelCollider.CenterOrigin(); AddCollider(repelCollider); // Set up soft spots softSpot1.CenterOrigin(); softSpot1.OriginX += softSpot1Offset.X; softSpot1.OriginY += softSpot1Offset.Y; softSpot2.CenterOrigin(); softSpot2.OriginX += softSpot2Offset.X; softSpot2.OriginY += softSpot2Offset.Y; AddColliders(softSpot1, softSpot2); softlight1 = new Light(); softlight1.SetAlpha(0.0f); softlight1.SetColor(new Color("C42679")); softlight1.SetRadius(300.0f); softlight1.SetOffset(softSpot1Offset); softlight1.entity = this; Level.lights.Add(softlight1); softlight2 = new Light(); softlight2.SetAlpha(0.0f); softlight2.SetColor(new Color("C42679")); softlight2.SetRadius(300.0f); softlight2.SetOffset(softSpot2Offset); softlight2.entity = this; Level.lights.Add(softlight2); // Lights eye1 = new Light(0, 4.0f); eye1.SetAlpha(0.6f); eye1.SetRadius(100.0f); eye1offset = new Vector2(-170, 50); eye1.SetOffset(eye1offset); eye1.entity = this; Level.lights.Add(eye1); eye2 = new Light(0, 4.0f); eye2.SetAlpha(0.6f); eye2.SetRadius(100.0f); eye2offset = new Vector2(-170, -15); eye2.SetOffset(eye2offset); eye2.entity = this; Level.lights.Add(eye2); // Reset direction to right direction = new Vector2(0, 1); // Set max speed maxspeed = 30.0f; }