Added in the icicle gun!
This commit is contained in:
parent
c7633a2a04
commit
9ab33bba38
Binary file not shown.
After Width: | Height: | Size: 334 B |
Binary file not shown.
After Width: | Height: | Size: 320 B |
|
@ -20,6 +20,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCGuns
|
|||
|
||||
this.guns.Add("Default", new SSCGuns.SSCGun(new StardustCore.Animations.AnimatedSprite("MyFirstGun", Vector2.Zero, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.White), SeasideScramble.self.entities.projectiles.getDefaultProjectile(this, Vector2.Zero, Vector2.Zero, 4f, new Rectangle(0, 0, 16, 16), Color.White, 4f, 300), 10, 1000, 3000));
|
||||
this.guns.Add("HeatWave", new SSCGuns.SSCGun_HeatWave(new StardustCore.Animations.AnimatedSprite("HeatWave", Vector2.Zero, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 18, 16)), Color.Red), SeasideScramble.self.entities.projectiles.getFireProjectile(this, Vector2.Zero, Vector2.Zero, 1.5f, new Rectangle(0, 0, 18, 16), Color.White, 3f, 3, SE_Burn.SpawnBurnEffect(Vector2.Zero, 3 * 1000, 1000, 1.00d, 2),150), 20, 200, 5000));
|
||||
this.guns.Add("Icicle", new SSCGuns.SSCGun(new StardustCore.Animations.AnimatedSprite("Icicle", Vector2.Zero, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.SkyBlue), SeasideScramble.self.entities.projectiles.getIcicleProjectile(this, Vector2.Zero, Vector2.Zero, 5.5f, new Rectangle(0, 0, 16, 16), Color.White, 3f, 5, 200), 5, 1000, 5000));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
}
|
||||
this.mouseSensitivity = new Vector2(3f, 3f);
|
||||
|
||||
this.getNewGun(SeasideScramble.self.guns.getGun("HeatWave")); //new SSCGuns.SSCGun(new StardustCore.Animations.AnimatedSprite("MyFirstGun", this.position, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.White), SeasideScramble.self.entities.projectiles.getDefaultProjectile(this, this.position, Vector2.Zero, 4f, new Rectangle(0, 0, 16, 16), Color.White, 4f, 300), 10, 1000, 3000);
|
||||
this.getNewGun(SeasideScramble.self.guns.getGun("Icicle")); //new SSCGuns.SSCGun(new StardustCore.Animations.AnimatedSprite("MyFirstGun", this.position, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.White), SeasideScramble.self.entities.projectiles.getDefaultProjectile(this, this.position, Vector2.Zero, 4f, new Rectangle(0, 0, 16, 16), Color.White, 4f, 300), 10, 1000, 3000);
|
||||
|
||||
|
||||
this.hitBox = new Rectangle((int)this.position.X, (int)this.position.Y, 64, 64);
|
||||
|
|
|
@ -95,6 +95,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCProjectiles
|
|||
/// </summary>
|
||||
public SSCStatusEffects.StatusEffect effect;
|
||||
|
||||
public bool pierces;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
|
@ -191,8 +193,11 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCProjectiles
|
|||
public virtual void collisionLogic()
|
||||
{
|
||||
//Do something I guess like play an animation.
|
||||
if (this.pierces == false)
|
||||
{
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What happens when the projectile collides with something.
|
||||
|
|
|
@ -97,6 +97,19 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCProjectiles
|
|||
return basic;
|
||||
}
|
||||
|
||||
public void spawnIcicleProjectile(object Owner, Vector2 Position, Vector2 Direction, float Speed, Rectangle HitBox, Color Color, float Scale,int Damage ,int LifeSpan = 300)
|
||||
{
|
||||
|
||||
SSC_IcicleProjectile basic = new SSC_IcicleProjectile(Owner, new StardustCore.Animations.AnimatedSprite("Icicle", Position, new StardustCore.Animations.AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Projectiles", "Icicle"), new StardustCore.Animations.Animation(0, 0, 16, 16)), Color), HitBox, Position, Direction, Speed, LifeSpan, Scale, Damage);
|
||||
this.addProjectile(basic);
|
||||
}
|
||||
public SSC_IcicleProjectile getIcicleProjectile(object Owner, Vector2 Position, Vector2 Direction, float Speed, Rectangle HitBox, Color Color, float Scale,int Damage ,int LifeSpan = 300)
|
||||
{
|
||||
|
||||
SSC_IcicleProjectile basic = new SSC_IcicleProjectile(Owner, new StardustCore.Animations.AnimatedSprite("Icicle", Position, new StardustCore.Animations.AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Projectiles", "Icicle"), new StardustCore.Animations.Animation(0, 0, 16, 16)), Color), HitBox, Position, Direction, Speed, LifeSpan, Scale, Damage);
|
||||
return basic;
|
||||
}
|
||||
|
||||
public void spawnFireProjectile(object Owner, Vector2 Position, Vector2 Direction, float Speed, Rectangle HitBox, Color Color, float Scale,int Damage,SSCStatusEffects.SE_Burn BurnEffect ,int LifeSpan = 300)
|
||||
{
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardustCore.Animations;
|
||||
|
||||
namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCProjectiles
|
||||
{
|
||||
public class SSC_IcicleProjectile:SSCProjectile
|
||||
{
|
||||
public float rotation;
|
||||
|
||||
public SSC_IcicleProjectile()
|
||||
{
|
||||
|
||||
}
|
||||
public SSC_IcicleProjectile(object Owner, AnimatedSprite Sprite, Rectangle HitBox, Vector2 Position, Vector2 Direction, float Speed, int LifeSpan, float Scale, int damage, SSCStatusEffects.StatusEffect Effect = null) : base(Owner, Sprite, HitBox, Position, Direction, Speed, LifeSpan, Scale, damage, Effect)
|
||||
{
|
||||
this.pierces = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void spawnClone(Vector2 position, Vector2 direction)
|
||||
{
|
||||
//AnimatedSprite newSprite = new AnimatedSprite(this.sprite.name, position, new AnimationManager(this.sprite.animation.objectTexture.Copy(), this.sprite.animation.defaultDrawFrame), this.color);
|
||||
SSC_IcicleProjectile basic = new SSC_IcicleProjectile(this.owner, new AnimatedSprite("IcicleProjectile", position, new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Projectiles", "Icicle"), new Animation(0, 0, 16, 16)), this.color), new Rectangle((int)this.position.X, (int)this.position.Y, this.hitBox.Width, this.hitBox.Height), position, direction, this.speed, this.maxLifeSpan, this.scale, this.damage, this.effect);
|
||||
basic.rotation = RotationUtilities.getRotationFromVector(direction);
|
||||
SeasideScramble.self.entities.projectiles.addProjectile(basic);
|
||||
}
|
||||
|
||||
public override void draw(SpriteBatch b)
|
||||
{
|
||||
this.sprite.draw(b, SeasideScramble.GlobalToLocal(SeasideScramble.self.camera.viewport, this.position), this.scale,this.rotation ,0.5f);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardustCore.Animations;
|
||||
|
||||
namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCStatusEffects
|
||||
{
|
||||
public class SE_Freeze:SSCStatusEffects.StatusEffect
|
||||
{
|
||||
|
||||
public SE_Freeze()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="Sprite"></param>
|
||||
/// <param name="Duration">The number of milliseconds the effect lasts.</param>
|
||||
/// <param name="Frequency">How many milliseconds pass between the effect triggering.</param>
|
||||
/// <param name="ChanceToAfflict">The chance this effect has to trigger. Value between 0-1.0</param>
|
||||
/// <param name="CanStack">Can this status effect stack?</param>
|
||||
public SE_Freeze(StardustCore.Animations.AnimatedSprite Sprite, double Duration, double Frequency, double ChanceToAfflict, bool CanStack, bool ResetsSameTimers) : base(Sprite, Duration, Frequency, ChanceToAfflict, CanStack, ResetsSameTimers)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawn a new burn status effect with the given paramaters.
|
||||
/// </summary>
|
||||
/// <param name="position">The position to draw the effect.</param>
|
||||
/// <param name="Duration">The duration of the effect in milliseconds.</param>
|
||||
/// <param name="Frequency">The freuency in milliseconds between triggers.</param>
|
||||
/// <param name="Chance">The chance to be afflicted.</param>
|
||||
/// <param name="Damage">The damage it does per trigger.</param>
|
||||
/// <returns></returns>
|
||||
public static SE_Freeze SpawnFreezeEffect(Vector2 position, double Duration, double Frequency, double Chance)
|
||||
{
|
||||
return new SE_Freeze(new StardustCore.Animations.AnimatedSprite("Freeze", position, new StardustCore.Animations.AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("SSCUI", "Freeze"), new Animation(0, 0, 16, 16)), Color.White), Duration, Frequency, Chance, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Revitalize.Framework.Utilities
|
||||
{
|
||||
public class RotationUtilities
|
||||
{
|
||||
public static float get90Degrees()
|
||||
{
|
||||
float angle = (float)Math.PI * .5f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
public static float get180Degrees()
|
||||
{
|
||||
float angle = (float)Math.PI;
|
||||
return angle;
|
||||
}
|
||||
|
||||
public static float get270Degrees()
|
||||
{
|
||||
float angle = (float)Math.PI * (1.5f);
|
||||
return angle;
|
||||
}
|
||||
|
||||
public static float get360Degrees()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a rotation from the degrees passed in.
|
||||
/// </summary>
|
||||
/// <param name="degrees"></param>
|
||||
/// <returns></returns>
|
||||
public static float getRotationFromDegrees(int degrees)
|
||||
{
|
||||
float amount = degrees / 180;
|
||||
float angle = (float)Math.PI * (amount);
|
||||
return angle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an angle from a passed in vector.
|
||||
/// </summary>
|
||||
/// <param name="vec"></param>
|
||||
/// <returns></returns>
|
||||
public static float getAngleFromVector(Vector2 vec)
|
||||
{
|
||||
Vector2 zero = new Vector2(1,0);
|
||||
vec = vec.UnitVector();
|
||||
float dot=Vector2.Dot(zero, vec);
|
||||
float len1 = vec.Length();
|
||||
float len2 = zero.Length();
|
||||
float lenTotal = len1 * len2;
|
||||
float cosAngle = dot / lenTotal;
|
||||
|
||||
float angle = (float)((Math.Acos(cosAngle)*180)/Math.PI);
|
||||
return angle;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a rotation amount for xna based off the unit circle.
|
||||
/// </summary>
|
||||
/// <param name="vec"></param>
|
||||
/// <returns></returns>
|
||||
public static float getRotationFromVector(Vector2 vec)
|
||||
{
|
||||
return getRotationFromDegrees((int)Math.Round(getAngleFromVector(vec)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -95,7 +95,9 @@
|
|||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCProjectiles\SSCProjectile.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCProjectiles\SSCProjectileManager.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCProjectiles\SSC_FireProjectile.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCProjectiles\SSC_IcicleProjectile.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCStatusEffects\SE_Burn.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCStatusEffects\SE_Freeze.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCStatusEffects\StatusEffect.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCStatusEffects\StatusEffectManager.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCTextureUtilities.cs" />
|
||||
|
@ -125,6 +127,7 @@
|
|||
<Compile Include="Framework\Utilities\BoundingBoxInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\InventoryManager.cs" />
|
||||
<Compile Include="Framework\Utilities\PyTKHelper.cs" />
|
||||
<Compile Include="Framework\Utilities\RotationUtilities.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\ContractResolvers\NetFieldContract.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\ItemCoverter.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\NetFieldConverter.cs" />
|
||||
|
@ -183,6 +186,9 @@
|
|||
<Content Include="Content\Minigames\SeasideScramble\Graphics\Projectiles\Fire.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Minigames\SeasideScramble\Graphics\Projectiles\Icicle.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Minigames\SeasideScramble\Graphics\UI\BlankTexture.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
@ -95,6 +95,11 @@ namespace StardustCore.Animations
|
|||
this.animation.draw(b, position, this.color, scale, SpriteEffects.None, depth);
|
||||
}
|
||||
|
||||
public virtual void draw(SpriteBatch b, Vector2 position, float scale,float rotation ,float depth)
|
||||
{
|
||||
this.animation.draw(b, position, this.color, scale, rotation,SpriteEffects.None, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the sprite to the screen.
|
||||
/// </summary>
|
||||
|
|
|
@ -383,6 +383,20 @@ namespace StardustCore.Animations
|
|||
}
|
||||
}
|
||||
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, float scale,float Rotation ,SpriteEffects flipped, float depth)
|
||||
{
|
||||
b.Draw(this.objectTexture.texture, Position, this.currentAnimation.sourceRectangle, drawColor, Rotation, Vector2.Zero, scale, flipped, depth);
|
||||
try
|
||||
{
|
||||
this.tickAnimation();
|
||||
// Log.AsyncC("Tick animation");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ModCore.ModMonitor.Log(err.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the animated texture to the screen.
|
||||
/// </summary>
|
||||
|
@ -406,6 +420,20 @@ namespace StardustCore.Animations
|
|||
}
|
||||
}
|
||||
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, Vector2 scale, float Rotation,SpriteEffects flipped, float depth)
|
||||
{
|
||||
b.Draw(this.objectTexture.texture, Position, this.currentAnimation.sourceRectangle, drawColor, Rotation, Vector2.Zero, scale, flipped, depth);
|
||||
try
|
||||
{
|
||||
this.tickAnimation();
|
||||
// Log.AsyncC("Tick animation");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ModCore.ModMonitor.Log(err.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public Texture2DExtended getExtendedTexture()
|
||||
{
|
||||
return this.objectTexture;
|
||||
|
|
Loading…
Reference in New Issue