// Walk horizontaly public override void WalkHorizontal(float targetSpeed) { // lerp the sprite scale (prob wont keep) imageScale = MyMaths.Lerp(imageScale, Math.Sign(targetSpeed), .25f * GahameController.GameSpeed * (GameInput.ControllerMode && !GahameController.CutScene ? Math.Abs(GameInput.AbsLeftStickX) : 1)); // keeps it from memeing maxSpeed targetSpeed = MyMaths.Clamp(targetSpeed, -maxSpeed, maxSpeed); // Approach the target speed physics.Velocity.X = MyMaths.Approach(physics.Velocity.X, targetSpeed, GahameController.GameSpeed * (physics.Grounded ? accelerationSpeed : airAccelerationSpeed)); // Sprite things if (spriteManager.CurrentSprite != "Moving") { spriteManager.ChangeSprite("Moving"); spriteManager.GetSprite("Moving").CurrentImage = 0; } spriteManager.GetSprite("Moving").ImageSpeed = .1f * Math.Abs(physics.Velocity.X / maxSpeed); // You be walking WalkingHorizontal = true; }
public void PlayerFoundClue(ClueObject clue) { // TODO: check if the object is the not-paper photo. If so, play PICKUP AudioPlayer.PlaySound(AudioClipIndex.PAPER); ClueItem item = clue.mItem; PersonState player = mPeople[0]; // add clue to journal if (item.info != null) { PlayerJournal.AddClue(item.info); } player.knowledge.AddKnowledge(item.info.GetSentence()); List <ClueItem> clues = mCluesInRooms[mCurrentRoom]; clues.Remove(item); Destroy(clue.gameObject); Sprite relevantImage = SpriteManager.GetSprite(item.spriteName); DialogBlock discussion = new DialogBlock(new PersonState[] { player }, OnClueDismissed); discussion.QueueDialogue(player, new Sprite[] { relevantImage }, item.description); mCluesFoundThisRound++; if (mCluesFoundThisRound >= MAX_CLUES_PER_ROUND) { discussion.QueueDialogue(player, new Sprite[] { }, "I'd better get back to the common area now."); } discussion.Start(); }
private Sprite AddSprite(Point point) { var spriteId = this.control.SelectedSpriteId; if (spriteId == -1) { return(null); } var sprite = SpriteManager.GetSprite(spriteId); _ = this.control.CurrentMap.AddSprite(point.X, point.Y, spriteId, sprite.Health); this.control.AddSprite(point, sprite); var listViewItem = new ListViewItem(); _ = listViewItem.SubItems.Add(spriteId.ToString()); _ = listViewItem.SubItems.Add(sprite.Name); _ = listViewItem.SubItems.Add(point.X.ToString()); _ = listViewItem.SubItems.Add(point.Y.ToString()); _ = listViewItem.SubItems.Add(sprite.Health == 0 ? "" : sprite.Health.ToString()); listViewItem.ImageKey = sprite.TextureID; _ = this.listView.Items.Add(listViewItem); return(sprite); }
public bool Initialize(GameMain gameMain, out string reason) { _gameMain = gameMain; if (!base.Initialize((gameMain.ScreenWidth / 2) - 320, (gameMain.ScreenHeight / 2) - 320, 640, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason)) { return(false); } _randomSprite = SpriteManager.GetSprite("RandomRace", gameMain.Random); if (_randomSprite == null) { reason = "RandomRace sprite does not exist."; return(false); } _raceButtons = new BBStretchButton[15]; _raceScrollBar = new BBScrollBar(); _raceBackground = new BBStretchableImage(); _raceDescription = new BBTextBox(); _okButton = new BBStretchButton(); _raceManager = gameMain.RaceManager; for (int i = 0; i < _raceButtons.Length; i++) { _raceButtons[i] = new BBStretchButton(); if (!_raceButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 10, _yPos + 10 + (i * 40), 280, 40, gameMain.Random, out reason)) { return(false); } } //Add 1 for the random race option int scrollValue = (_raceManager.Races.Count + 1) < _raceButtons.Length ? _raceButtons.Length : (_raceManager.Races.Count + 1); if (!_raceScrollBar.Initialize(_xPos + 290, _yPos + 10, 600, _raceButtons.Length, scrollValue, false, false, gameMain.Random, out reason)) { return(false); } _maxVisible = (_raceManager.Races.Count + 1) > _raceButtons.Length ? _raceButtons.Length : (_raceManager.Races.Count + 1); if (_raceManager.Races.Count < 15) { _raceScrollBar.SetEnabledState(false); } if (!_raceBackground.Initialize(_xPos + 310, _yPos + 10, 310, 550, StretchableImageType.ThinBorderBG, gameMain.Random, out reason)) { return(false); } if (!_raceDescription.Initialize(_xPos + 315, _yPos + 325, 300, 215, true, true, "RaceSelectionDescriptionTextBox", gameMain.Random, out reason)) { return(false); } if (!_okButton.Initialize("Select Race", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 310, _yPos + 570, 310, 40, gameMain.Random, out reason)) { return(false); } RefreshRaceLabels(); RefreshRaceDescription(); reason = null; return(true); }