// CONSTRUCTORS public MenuHome() { this.head1 = new EntityAnimatedSprite(new AnimatedSprite("playerHead", 1, 1, 10, 1f, 1f)); this.head1.ESprite.Origin = new Vector2(this.head1.ESprite.Width / 20, this.head1.ESprite.Height / 20); this.head1.ESprite.X = 0; this.head1.ESprite.Y = Misc.WindowHeight; this.head2 = new EntityAnimatedSprite(new AnimatedSprite("playerHead", 1, 1, 10, 1f, 1f)); this.head2.ESprite.Origin = new Vector2(this.head2.ESprite.Width / 20, this.head2.ESprite.Height / 20); this.head2.ESprite.X = Misc.WindowWidth; this.head2.ESprite.Y = Misc.WindowHeight; this.background = new EntitySprite(new Sprite("home_background", 4, false)); this.title = new EntitySprite(new Sprite("title", 2, true)); this.title.ESprite.X = Misc.WindowWidth / 2 - this.title.ESprite.Width / 2; this.title.ESprite.Y = Misc.WindowHeight / 2 - this.title.ESprite.Height * 2 - this.title.ESprite.Height / 2; this.startButton = new EntityButton("PLAY"); this.startButton.ESprite.X = Misc.WindowWidth / 2 - this.startButton.ESprite.Width / 2; this.startButton.ESprite.Y = Misc.WindowHeight / 2 - this.startButton.ESprite.Height / 2; this.quitButton = new EntityButton("QUIT"); this.quitButton.ESprite.X = Misc.WindowWidth / 2 - this.quitButton.ESprite.Width / 2; this.quitButton.ESprite.Y = Misc.WindowHeight / 2 + this.quitButton.ESprite.Width / 2; this.madeFor = new Text("Made by MatKubik for Ludum Dare 39", "ButtonFont", Misc.WindowWidth / 2, Misc.WindowHeight - 25); this.madeFor.TextColor = Color.Orange; }
// CONSTRUCTORS public MenuGO() { this.background = new EntitySprite(new Sprite("gobackground", 4, false)); this.scorePanel = new EntitySprite(new Sprite("scorePanel", 3, false)); this.scorePanel.ESprite.X = Misc.WindowWidth / 2 - this.scorePanel.ESprite.Width / 2; this.scorePanel.ESprite.Y = 90; this.homeButton = new EntityButton("HOME"); this.homeButton.ESprite.X = Misc.WindowWidth / 2 - this.homeButton.ESprite.Width / 2; this.homeButton.ESprite.Y = Misc.WindowHeight / 2 + this.homeButton.ESprite.Height * 2; this.grayBarrelNumber = new Text("x" + Misc.grayBarrelGet, "ButtonFont", this.scorePanel.ESprite.X + 17 * 3, this.scorePanel.ESprite.Y + 21 * 3); this.grayBarrelNumber.TextColor = Color.DarkGray; this.blueBBarrelNumber = new Text("x" + Misc.blueBarrelGet, "ButtonFont", this.scorePanel.ESprite.X + 55 * 3, this.scorePanel.ESprite.Y + 21 * 3); this.blueBBarrelNumber.TextColor = Color.DarkBlue; this.redBarrelNumber = new Text("x" + Misc.redBarrelGet, "ButtonFont", this.scorePanel.ESprite.X + 93 * 3, this.scorePanel.ESprite.Y + 21 * 3); this.redBarrelNumber.TextColor = Color.DarkRed; this.questionBarrelNumber = new Text("x" + Misc.questionBarrelGet, "ButtonFont", this.scorePanel.ESprite.X + 131 * 3, this.scorePanel.ESprite.Y + 21 * 3); this.t1 = new Text("TIME :", "ButtonFont", this.scorePanel.ESprite.X + 176 * 3, this.scorePanel.ESprite.Y + 6 * 3); this.t2 = new Text(Misc.playTimer, "ButtonFont", this.scorePanel.ESprite.X + 175 * 3, this.scorePanel.ESprite.Y + 21 * 3); this.t1.TextColor = Color.DarkGreen; this.t2.TextColor = Color.LightGray; this.youDied = new Text("YOU DIDN'T HAVE ENOUGH POWER TO SURVIVE!", "timerFont", Misc.WindowWidth / 2, Misc.WindowHeight / 2); this.youDied.TextColor = Color.Red; this.stats = new Text("YOUR STATS", "ButtonFont", Misc.WindowWidth / 2, Misc.WindowHeight / 2 - 75); this.stats.TextColor = Color.Yellow; }
void addSprite(object param) { EntityNode source = param as EntityNode; OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Sprite Files (*.png, *.bmp)|*.png;*.bmp"; bool?dialogOpen = dialog.ShowDialog(); dialog.Multiselect = false; if (dialogOpen == true) { using (new WaitCursorHelper()) { Debug.WriteLine("Filepath:" + dialog.FileName); byte[] image = File.ReadAllBytes(dialog.FileName); MemoryStream imageMemoryStream = new MemoryStream(image); BitmapImage loadedImage = new BitmapImage(); loadedImage.CacheOption = BitmapCacheOption.OnLoad; loadedImage.BeginInit(); loadedImage.StreamSource = imageMemoryStream; loadedImage.EndInit(); //Entity EntitySprite entitySprite = new EntitySprite(source, Path.GetFileNameWithoutExtension(dialog.FileName), loadedImage); source.Childs.Add(entitySprite); } } }
private void Start() { Health = 100; Speed = 10f; _heroSprite = GetComponent <EntitySprite>(); _positionClamper = GetComponent <PositionClamper>(); }
private void DeathAnim() { hpBar.enabled = false; mask_hp.alphaCutoff = 1; DOTween.To(() => mask_hpEffect.alphaCutoff, alpha => mask_hpEffect.alphaCutoff = alpha, 1, 0.3f).OnComplete(() => { hpBar.DOFade(0, 0.5f); EntitySprite.DOColor(Color.black, 0.5f); EntitySprite.DOFade(0, 0.5f).OnComplete(() => Destroy(gameObject)); m_glowEffect.GlowColor = Color.black; }); }
public override void Initialize() { base.Initialize(); slice_angle = Mathf.Cos(Mathf.Deg2Rad * 22.5f); rotation_vectors = new Vector2[8]; rotation_vectors[0] = Vector2.up; rotation_vectors[1] = (Vector2.up - Vector2.right).normalized; rotation_vectors[2] = -Vector2.right; rotation_vectors[3] = (-Vector2.up - Vector2.right).normalized; rotation_vectors[4] = -Vector2.up; rotation_vectors[5] = (-Vector2.up + Vector2.right).normalized; rotation_vectors[6] = Vector2.right; rotation_vectors[7] = (Vector2.up + Vector2.right).normalized; sprite_renderer = EntitySprite.GetComponent <SpriteRenderer>(); }
// CONSTRUCTORS public MenuGame() { Misc.blueBarrelGet = 0; Misc.redBarrelGet = 0; Misc.grayBarrelGet = 0; Misc.questionBarrelGet = 0; Misc.playTimer = ""; this.speedPlusTimer = 0f; this.timerPanel = new EntityAnimatedSprite(new AnimatedSprite("uiPanel", 1, 1, 6, 1f, 1f)); this.timerPanel.ESprite.Effect = SpriteEffects.FlipHorizontally; this.timerPanel.ESprite.X = Misc.WindowWidth - this.timerPanel.ESprite.Width; this.playTimer = new Timer(this.timerPanel.ESprite.X + this.timerPanel.ESprite.Width / 2, this.timerPanel.ESprite.Y + this.timerPanel.ESprite.Height / 2); this.barrels = new List <EntityBarrel>(); this.randPlatSpawnTime = 0; this.timer = 0f; this.rand = new Random(); this.groundSpeed = 6; this.background = new EntitySprite(new Sprite("background", 4, false)); this.ground = new EntitySprite(new Sprite("ground", 4, false)); this.ground.ESprite.Y = Misc.WindowHeight - this.ground.ESprite.Height; this.ground1 = new EntitySprite(new Sprite("ground", 4, false)); this.ground1.ESprite.Y = Misc.WindowHeight - this.ground1.ESprite.Height; this.ground1.ESprite.X = Misc.WindowWidth; this.player = new EntityPlayer(this.ground.ESprite.Y); this.player.ESprite.Y = this.ground.ESprite.Y - this.player.ESprite.Height; this.randPlatSpawnTime = rand.Next(2000, 5000); this.playerFloorCollsPos = this.ground.ESprite.Y; }
public override void DropAnimation() { transform.GetChild(0).localPosition = new Vector3(0, 0.15f, 0); EntitySprite.DOFade(0, 0); }
public void FaceTowards(EntitySprite other) { sr.flipX = other.transform.position.x < transform.position.x; }