public override void Added() { base.Added(); // Create main fire ball particle system Particle_Dust = new ParticleSystem( X, Y ); Particle_Dust.Initialize( 50, 20, 0, 360, 5, 15, "../../resources/particle/smoke.png", 87, 87, 0.8f ); Particle_Dust.particleShake = 1; Particle_Dust.beginColour = Color.Gray * Color.Gray * Color.Orange + Color.Gray; Particle_Dust.beginColour.A = 0.5f; Particle_Dust.endColour = Color.Black; Particle_Dust.endColour.A = 0; Particle_Dust.particleEndScale = 5.0f; Particle_Dust.particleStartRotation = Rand.Float( -720, 720 ); Particle_Dust.particleEndRotation = Rand.Float( -720, 720 ); Particle_Dust.particleLocalSpace = true; Particle_Dust.Start(); Scene.Add( Particle_Dust ); // Intitialize the ground trail mark image GroundTrail = new Otter.Image( "../../resources/particle/scorch.png" ); // Initialize trail mark timers to seconds TrailBetween = TRAIL_BETWEEN * 60; TrailBetweenRandom = TRAIL_BETWEEN_RANDOM * 60; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the dust storm audio loop AudioLoop = new Sound( "../../resources/audio/dust.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public override void Added() { base.Added(); // Create main spell particle system Particle_Spray = new ParticleSystem( X, Y ); Particle_Spray.Initialize(10, 10, 0, 360, 15, 15, "../../resources/particle/water_circle.png", 87, 87, 1.5f); Particle_Spray.beginColour = Color.White; Particle_Spray.endColour = (Color.Blue * Color.Gray * Color.Gray); Particle_Spray.endColour.A = 0; Particle_Spray.particleShake = 4; Particle_Spray.particleStartRotation = Rand.Float(-360, 360); Particle_Spray.particleEndRotation = Rand.Float(-360, 360); Particle_Spray.Start(); Scene.Add(Particle_Spray); GroundSplat = new Otter.Image("../../resources/particle/splash.png"); GroundSplat.Color = Color.Cyan; GroundSplat.Scale = 2.5f; GroundSplat.Color.A = 0.4f; GroundTrail = new Otter.Image("../../resources/particle/splash.png"); GroundTrail.Color = Color.Cyan; GroundTrail.Color.A = 0.2f; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the fire audio loop AudioLoop = new Sound( "../../resources/audio/water.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public Monster1Blue(float x = 0, float y = 0) : base(baseSpeed:600) { X = x; Y = y; HurtSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_HIT); HurtSound.Volume = 0.1f; DeathSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_EXPLOSION); DeathSound.Volume = 0.7f; Sprite = new Spritemap<string>(Resources.Sprites.Monsters.ENEMY_1_BLUE, 46, 46); Sprite.Add("walk", new int[] { 0, 1, 2, 3, 4, 5 }, new float[] { 10f, 2f, 1f, 10f, 2f, 1f }); Sprite.Play("walk"); Graphic = Sprite; Graphic.CenterOrigin(); Health = new Life(10); Health.OnDeath = OnDeath; Health.OnHurt = OnHurt; Direction = Vector2.Zero; var c = new LinkedListNode<Vector2>(new Vector2(50.0f, 50.0f)); var t = new LinkedList<Vector2>(); Path = c; t.AddLast(c); t.AddLast(new Vector2(Global.GAME.Width - 50.0f, 50.0f)); t.AddLast(new Vector2(Global.GAME.Width - 50.0f, Global.GAME.Height - 50.0f)); t.AddLast(new Vector2(50, Global.GAME.Height - 50.0f)); AddComponent(new CheckPointMovement(this, Path)); AddComponent(new Rotation(this, 90)); AddComponent(Health); SetHitbox(23, 23, Global.HitBoxTag.Enemy); }
public override void Added() { base.Added(); // Create main fireball particle system Particle_Fire = new ParticleSystem( X, Y ); Particle_Fire.Initialize( 50, 20, 0, 360, 5, 15, "../../resources/particle/fire.png", 87, 87, 0.8f ); Particle_Fire.beginColour = Color.Orange + ( Color.Yellow * Color.Gray * Color.Gray ); Particle_Fire.endColour = Color.Red; Particle_Fire.endColour.A = 0; Particle_Fire.particleLocalSpace = true; Particle_Fire.Start(); Scene.Add( Particle_Fire ); // Create fireball trail particle system Particle_Fire_Trail = new ParticleSystem( X, Y ); Particle_Fire_Trail.Initialize( 100, 20, 0, 180, 5, 10, "../../resources/particle/fire.png", 87, 87, 0.8f ); Particle_Fire_Trail.beginColour = Color.Orange + ( Color.Yellow * Color.Gray * Color.Gray ); Particle_Fire_Trail.endColour = Color.Red; Particle_Fire_Trail.endColour.A = 0; Particle_Fire_Trail.Start(); Scene.Add( Particle_Fire_Trail ); GroundSplat = new Otter.Image( "../../resources/particle/ground_explosion.png" ); // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the fire audio loop AudioLoop = new Sound( "../../resources/audio/fire.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public ToCloserMonsterWeapon(Turret tower) : base(range:tower.Range, damage:4, cooldown:40) { ShootSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_SHOOT); ShootSound.Volume = 0.2f; Tower = tower; }
public AoEWeapon(Turret tower) : base(range:tower.Range, damage:1, cooldown: 13) { ShootSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_SHOOT); ShootSound.Volume = 0.2f; Tower = tower; Range = 100; RangeImage = Image.CreateCircle(100, new Color(0x25456320)); RangeImage.CenterOrigin(); Tower.AddGraphic(RangeImage); }
public void DropBombs() { Sound bip = new Sound(Assets.SFX_CHARGE); bip.Volume = 0.9f; bip.Play(); // Create 8 missiles for (int i = 0; i < 8; i++) { Missile newMissile = new Missile(X, Y); newMissile.Graphic.Angle = Rand.Float(0, 360); this.Scene.Add(newMissile); } Global.Bombs--; }
public override void Added() { base.Added(); // Initialie collider SetHitbox( 10, 10, ( (int) ColliderType.Spell ) + ID ); Hitbox.CenterOrigin(); // Initialize trail mark timers to seconds TrailBetween = TRAIL_BETWEEN * 60; TrailBetweenRandom = TRAIL_BETWEEN_RANDOM * 60; // Initialize the default audio loop AudioLoop = new Sound( "../../resources/audio/magichappens.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public override void Removed() { // Create paff Particle paff = new Particle(X, Y, Assets.GFX_MISSILEBREAK, 32, 32); paff.LifeSpan = 10.0f; paff.FrameCount = 6; paff.FinalAlpha = 1.0f; paff.Image.CenterOrigin(); this.Scene.Add(paff); Sound bip = new Sound(Assets.SFX_BOOM); bip.Volume = 0.9f; bip.Pitch = Rand.Float(0.8f, 1.2f); bip.Play(); base.Removed(); }
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 }
public Controller() { BPM = 175*0.5f; BPMConstant = BPM / 60; FramesPerBeat = 60 / BPMConstant; Vector2 pos = new Vector2(320 - 16, 320 - 16); Vector2[] dirs = new Vector2[] { Vector2.UnitX, Vector2.UnitY, -Vector2.UnitX, -Vector2.UnitY }; int d = Rand.Int(0, 4); for (int i = 0; i < 100; i++) { d = Rand.Int(0, 4); pos += dirs[d] * 32; tiles.Add(Tuple.Create(pos, d)); } Layer = 1000; BIP = new Sound("bip.wav",false); song = new Sound("music.ogg", false); //song.Play(); }
public override void Update() { base.Update(); // Fly towards player Vector2 VectorToPlayer = new Vector2(Global.theGhost.X - X, Global.theGhost.Y - Y - 10); if(VectorToPlayer.Length < 2) { Global.Score++; Sound bip = new Sound(Assets.SFX_GET); bip.Volume = 0.6f; bip.Pitch = Rand.Float(0.8f, 1.2f); bip.Play(); RemoveSelf(); //Global.theMusic.Pitch += 0.01f; } VectorToPlayer.Normalize(); X += VectorToPlayer.X * 3; Y += VectorToPlayer.Y * 3; }
public override void Added() { base.Added(); // Add base rock image to projectile Graphic = new Otter.Image( "../../resources/particle/rock" + Rand.Int( 1, IMAGE_ROCKS ) + ".png" ); Graphic.CenterOrigin(); // Add the circling smaller rocks int extras = ROCK_EXTRA + Rand.Int( -ROCK_EXTRA_RANDOM, ROCK_EXTRA_RANDOM ); for ( int extra = 1; extra <= extras; extra++ ) { AddGraphic( new Otter.Image( "../../resources/particle/rock_small" + Rand.Int( 1, IMAGE_ROCKS_SMALL ) + ".png" ) ); Graphics[extra].OriginX = -ROCK_EXTRA_OFFSET; Graphics[extra].OriginY = -ROCK_EXTRA_OFFSET; Graphics[extra].Angle = 360 / extras * extra; } // Create main fire ball particle system Particle_Dust = new ParticleSystem( X, Y ); Particle_Dust.Initialize( 50, 20, 0, 360, 1, 15, "../../resources/particle/smoke.png", 87, 87, 0.8f ); Particle_Dust.particleShake = 1; Particle_Dust.beginColour = Color.Gray * Color.Gray * Color.Orange + Color.Gray; Particle_Dust.beginColour.A = 0.5f; Particle_Dust.endColour = Color.Black; Particle_Dust.endColour.A = 0; Particle_Dust.particleStartScale = 0.1f; Particle_Dust.particleEndScale = 1.0f; Particle_Dust.particleStartRotation = Rand.Float( -720, 720 ); Particle_Dust.particleEndRotation = Rand.Float( -720, 720 ); Particle_Dust.particleLocalSpace = true; Particle_Dust.Start(); Scene.Add( Particle_Dust ); // Intitialize the ground trail mark image GroundTrail = new Otter.Image( "../../resources/particle/scorch.png" ); // Initialize trail mark timers to seconds TrailBetween = TRAIL_BETWEEN * 60; TrailBetweenRandom = TRAIL_BETWEEN_RANDOM * 60; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the dust storm audio loop AudioLoop = new Sound( "../../resources/audio/dust.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public override void Added() { base.Added(); // Draw wizard on top of all but the HUD & particles Layer = 8 + ID; // Initialize the wizard's shader //TestShader = new Shader( "../../shaders/video.fs" ); // Initialize the position interpolation objects ClampedPosition_X.Speed = 7; ClampedPosition_Y.Speed = 7; // Initialize the position of the wizard Position = new Vector2( 0, 0 ); Destination = new Vector2( 0, 0 ); // Initialize the wizard type unique variables string wizardtypeimage = "light"; WandOffset = WAND_OFFSET; { if ( WizardType == WizardTypeStruct.WIZARD_DARK ) { wizardtypeimage = "dark"; WandOffset *= -1; WandAngleDirection *= -1; } } // Initialize the wizard's body sprite Body = new Otter.Image( "../../resources/wizard_" + wizardtypeimage + ".png" ); { Body.ScaleX = SPRITE_SCALE; Body.ScaleY = SPRITE_SCALE; Body.Angle = Angle; Body.CenterOrigin(); } // Body graphic is added later after wand // Initialize the wizard's wand sprite WandOffset *= new Vector2( Body.Width * SPRITE_SCALE, Body.Height * SPRITE_SCALE ); // Multiply offset by the size of the wizard body Wand = new Otter.Image( "../../resources/wand_" + wizardtypeimage + ".png" ); { Wand.ScaleX = SPRITE_SCALE; Wand.ScaleY = SPRITE_SCALE; Wand.Angle = Angle + WandAngle; Wand.CenterOrigin(); Wand.OriginY = Wand.Height; //Wand.Shader = TestShader; } // Add the graphics to the scene AddGraphic( Wand ); // Add wand below wizard robes AddGraphic( Body ); // Add a hitbox to the wizard int size = (int) Math.Floor( Body.Width * Body.ScaleX * HITBOX_SCALE ); SetHitbox( size, size, ( (int) ColliderType.Wizard ) + ID ); Hitbox.CenterOrigin(); // Calculate the forward & right vectors of this wizard double radangle = Math.PI * Angle / 180; double sin = Math.Sin( radangle ); double cos = Math.Cos( radangle ); Vector2 origin = new Vector2( 0, 1 ); // Default is facing upwards Forward = new Vector2( (float) ( ( (double) origin.X * cos ) - ( (double) origin.Y * sin ) ), (float) ( ( (double) origin.X * sin ) + ( (double) origin.Y * cos ) ) ); Right = new Vector2( Forward.Y, Forward.X ); // Initialize the clamped position of the wizard (for player movement) { // Calculate the side of the screen the player is on float side = Math.Sign( Forward.X ); // -1, 0, 1 float onleft = Math.Max( 0, side ); // 0 or 1 boolean number float onright = Math.Max( 0, -side ); // 0 or 1 boolean number // X float halfwidth = Body.Width * Body.ScaleX * COLLISION_SCALE; // Image is centered, ensure the whole thing stays onscreen ClampedX.Minimum = ( Game.Instance.HalfWidth * onright ) + halfwidth; ClampedX.Maximum = Game.Instance.Width - ( Game.Instance.HalfWidth * onleft ) - halfwidth; // Y float halfheight = Body.Height * Body.ScaleY * COLLISION_SCALE; // Image is centered, ensure the whole thing stays onscreen ClampedY.Minimum = halfheight; ClampedY.Maximum = Game.Instance.Height - halfheight; } // Initialize the hurt sound effects Hurt = new Sound[SOUND_HURT]; { for ( short effect = 0; effect < SOUND_HURT; effect++ ) { Hurt[effect] = new Sound( "../../resources/audio/hurt" + ( effect + 1 ) + ".wav" ); Hurt[effect].Attenuation = 0.1f; } } }
public override void Added() { base.Added(); float offsetsin = Rand.Float( -180, 180 ); // Create first vine VineSineOne = new SineWave( 5, 1, offsetsin ); VineOne = new ParticleSystem( X, Y - VineSineOne.Value * 100 ); VineOne.Initialize( 0, 0, 0, 0, 1, 60, "../../resources/particle/vine.png", 87, 87, 0.3f ); VineOne.beginColour = Color.Orange * Color.Gray; VineOne.endColour = ( Color.Green * Color.Gray * Color.Red ); VineOne.endColour.A = 0; VineOne.particleShake = 4; VineOne.particleStartRotation = ( VineSineOne.Value * ( 180.0f / (float) Math.PI ) ) * 2; VineOne.particleEndRotation = VineOne.particleStartRotation; VineOne.Start(); Scene.Add( VineOne ); this.AddComponent( VineSineOne ); // Create second vine VineSineTwo = new SineWave( 5, 1, 180.0f + offsetsin ); VineTwo = new ParticleSystem( X, Y - VineSineTwo.Value * 100 ); VineTwo.Initialize( 0, 0, 0, 0, 1, 60, "../../resources/particle/vine.png", 87, 87, 0.3f ); VineTwo.beginColour = Color.Orange * Color.Gray; VineTwo.endColour = ( Color.Green * Color.Gray * Color.Red ); VineTwo.endColour.A = 0; VineTwo.particleShake = 4; VineTwo.particleStartRotation = ( VineSineTwo.Value * ( 180.0f / (float) Math.PI ) ) * 2; VineTwo.particleEndRotation = VineTwo.particleStartRotation; VineTwo.Start(); Scene.Add( VineTwo ); this.AddComponent( VineSineTwo ); GroundTrail = new Otter.Image( "../../resources/particle/leaf.png" ); GroundTrail.Color = Color.Green * Color.Gray * Color.Yellow; TrailBetween = 5; TrailBetweenRandom = 5; // Remove default audio sample AudioLoop.Stop(); AudioLoop = null; // Initialize the fire audio loop AudioLoop = new Sound( "../../resources/audio/vine.wav", true ); AudioLoop.Attenuation = 0.1f; AudioLoop.Play(); }
public override void Update() { base.Update(); if(CurrentActivity == 0) { //nada } if(CurrentActivity == 1) { // charging laser if(ChargeTime < MaxChargeTime) { ChargeTime++; //update anim mySprite.Anim("charge").Speed((ChargeTime / (MaxChargeTime)) * 4); // drift towards player Vector2 VectorToPlayer = new Vector2(Global.theGhost.X - X, Global.theGhost.Y - Y); if(VectorToPlayer.Length > 500) { // teleport to player X = Rand.Float(Global.theGhost.X - 400, Global.theGhost.X + 400); Y = Rand.Float(Global.theGhost.Y - 400, Global.theGhost.Y + 400); } VectorToPlayer.Normalize(); X += VectorToPlayer.X * 0.5f; Y += VectorToPlayer.Y * 0.5f; } else { FireLaser(); } } if(CurrentActivity == 2) { // firing laser if(CurrentFireTime < MaxFireTime) { CurrentFireTime++; // create laser particles, aim at player, then tween angle displacement slowly float ProgressThroughFire = CurrentFireTime / MaxFireTime; Vector2 VectorToPlayer = new Vector2(TargetPos.X - X, TargetPos.Y - Y); float AngleToPlayer = (float)Math.Atan2(VectorToPlayer.Y, VectorToPlayer.X); AngleToPlayer *= (float)(180.0 / Math.PI); if(FireDir) { AngleToPlayer += (-15) + (ProgressThroughFire * 30); } else { AngleToPlayer -= (-15) + (ProgressThroughFire * 30); } AngleToPlayer *= (float)(Math.PI / 180.0); Laser newLaser = new Laser(X, Y, (float)Math.Cos(AngleToPlayer) * 7, (float)Math.Sin(AngleToPlayer) * 7); this.Scene.Add(newLaser); } else { ChargeUpLaser(); } } if(CurrentActivity == 3) { RemoveColliders(Collider); mySprite.Play("dead"); return; } if(Collider.Overlap(X, Y, 1)) { // Hit by star, die // spawn music note & particles Hits--; if(Hits <= 0) { this.Scene.Add(new Note(X, Y)); int maxSpawn = 1 + ((int)Global.Score / 200); for (int i = 0; i < maxSpawn; i++) { this.Scene.Add(new Drone(Rand.Float(Global.theGhost.X - 400, Global.theGhost.X + 400), Rand.Float(Global.theGhost.Y - 400, Global.theGhost.Y + 400), maxSpawn * 2)); } CurrentActivity = 3; mySprite.OriginY -= 14; Layer = 10; mySprite.ShakeX = 3; Sound bip = new Sound(Assets.SFX_HURT); bip.Volume = 0.9f; bip.Pitch = Rand.Float(0.8f, 1.2f); bip.Play(); } } }
public void FireLaser() { mySprite.Play("fire"); CurrentActivity = 2; CurrentFireTime = 0; FireDir = Rand.Bool; // capture player location/angle relative to us TargetPos = new Vector2(Global.theGhost.X, Global.theGhost.Y); Sound bip = new Sound(Assets.SFX_DRONEFIRE); bip.Volume = 0.3f; bip.Play(); }
public override void Removed() { base.Removed(); // Cleanup the main audio loop AudioLoop.Stop(); AudioLoop = null; }
public void ShootInDirection(Vector2 shootAxis) { // Shoot stars if ((shootAxis.Length > 0.9) && RefireTime <= 0.0 && hurtTime <= 0.0) { RefireTime = MaxRefire; float XSpeedOfStar = 4.0f * shootAxis.X; float YSpeedOfStar = 4.0f * shootAxis.Y; Star newStar = new Star(X, Y, XSpeedOfStar, YSpeedOfStar); this.Scene.Add(newStar); Sound bip = new Sound(Assets.SFX_SHOOT); bip.Volume = 0.9f; bip.Play(); mySpeed.X -= shootAxis.X * 0.2f; mySpeed.Y -= shootAxis.Y * 0.2f; } }
public override void Update() { base.Update(); // Input & Movement if (!Impostor) { HandleInput(); } else { HandleImpostorInput(); } X += mySpeed.X; Y += mySpeed.Y; if (RefireTime > 0.0f) { RefireTime--; } // Hit By Laser if (Collider.Overlap(X, Y, 3) && hurtTime <= 0.0f) { // Got hurt! hurtTime = 45.0f; Global.theCamShaker.ShakeCamera(20.0f); // reduce score / screw with music Global.Score -= 10 + ((Global.Score / 100) * 10); //Global.theMusic.Pitch -= 0.01f; Sound bip = new Sound(Assets.SFX_HURT); bip.Volume = 0.9f; bip.Play(); } }