void Update() { _ball.Step(); _text.Clear(Color.Transparent); _text.Text("POS X,Y = " + _ball.x + "," + _ball.y, 0, 0); }
void Update() { // For now: this just puts the ball at the mouse position: _ball.Step(); //TODO: calculate correct distance from ball center to line Vec2 distanceLineBall = _lineSegment.end - _ball.position; Vec2 lineVector = _lineSegment.start - _lineSegment.end; float ballDistance = distanceLineBall.Dot(lineVector.Normal()); //HINT: it's NOT 10000 //compare distance with ball radius if (ballDistance < _ball.radius) { _ball.position -= (-ballDistance + _ball.radius) * lineVector.Normal(); _ball.velocity.ReflectOnLine(lineVector, _bounciness); _ball.SetColor(1, 0, 0); } else { _ball.SetColor(0, 1, 0); } _text.Clear(Color.Transparent); _text.Text("Distance to line: " + ballDistance, 0, 0); Reset(); }
void Update() { // For now: this just puts the ball at the mouse position: _ball.Step(); NLineSegment line = getEarlyestCol(); //TODO: calculate correct distance from ball center to line //compare distance with ball radius if (line != null) { ballReset(line); } else { _ball.SetColor(0, 1, 0); } _text.Clear(Color.Transparent); _text.Text("Distance to line: " + currentDist, 0, 0); }
void Update() { _ball.Step(); _text.Clear(Color.Transparent); _text.Text("Velocity: " + _ball.velocity, 0, 0); }
public HistoricImageHud(string historyFileName) : base("data/White Texture.png", true, false) { var bg = new EasyDraw(game.width, game.height, false); bg.Clear(Color.FromArgb(0, Color.Black)); AddChild(bg); _mainImage = new Sprite(historyFileName, true, false); AddChild(_mainImage); //_mainImage.scale = 0.5f; _mainImage.SetOriginToCenter(); _mainImage.SetXY(MyGame.HALF_SCREEN_WIDTH, MyGame.HALF_SCREEN_HEIGHT); DrawableTweener.TweenSpriteAlpha(_mainImage, 0, 1, 400, Easing.Equation.CubicEaseOut); var textBg = new EasyDraw(game.width, 30, false); textBg.Clear(Color.Black); AddChild(textBg); textBg.SetXY(0, game.height - 30); var pressToContinueText = new DebugTextBox("Press Esc to continue", game.width, 30, 0xffffff, 0x00010101, CenterMode.Center, CenterMode.Center); AddChild(pressToContinueText); pressToContinueText.SetXY(0, game.height - 30); DrawableTweener.Blink(pressToContinueText, 1, 0, 400); }
private void updateValues() { Item _item = _items.Item[_indexItems]; _easyDraw.Clear(Color.Transparent); _easyDraw.graphics.DrawString(_player.GetCoinsNumber().ToString(), _font, new SolidBrush(Color.White), new PointF(172, 172.5f)); _easyDraw.graphics.DrawString(_item.Cost.ToString(), _font, new SolidBrush(Color.White), new PointF(65, 172.5f)); }
/// <summary>Set the text. Int numbers mean color in RGB format /// </summary> public void SetText(string text, float fontsize, int a = 0, int b = 0, int c = 0) { _easyDraw.Clear(Color.Transparent); _easyDraw.TextSize(fontsize); _easyDraw.Text(text, _easyDraw.width / 2, _easyDraw.height / 2); _easyDraw.Fill(a, b, c); }
private void updatePotionsValueOnScreen() { _easyDraw.Clear(Color.Transparent); //Life potions number _easyDraw.graphics.DrawString(_health_potion_number.ToString(), _font, new SolidBrush(Color.White), new PointF(17, 12)); //Mana potions number _easyDraw.graphics.DrawString(_mana_potion_number.ToString(), _font, new SolidBrush(Color.White), new PointF(45, 12)); }
void Update() { _ball.Step(); if (_ball.gameOver == true) { timer.PauseTime(); } _text.Clear(Color.Transparent); _text.Text("Velocity: " + _ball.velocity, 0, 0); }
void Update() { text.Clear(Color.Transparent); text.Text(buttonText, 0, 0); text.alpha -= fadeSpeed; if (text.alpha == 0 || text.alpha == 1) { fadeSpeed = -fadeSpeed; } }
private void Update() { if (_ball.IsDone) { return; } _ball.Step(); score += Time.deltaTime; _text.Clear(Color.Transparent); _text.Text($"Score: {(int)score}", 0, 0); }
/*----------------------------------------- * drawText() * ----------------------------------------*/ private void drawText() { _scoreHud.Clear(Color.Empty); _scoreHud.Text("Score: " + _tank.GetScore(), 0, 0); _livesHud.Clear(Color.Empty); _scoreHud.Text("Lives: " + _tank.GetLives(), 0, 20); if (_tank.GetIsDead()) { _deathScreen.Clear(Color.Empty); _deathScreen.Text("Game Over :(", 570, 200); } }
public StartScreen() : base(Settings.StartScreen_Bg_Image, false, false) { GameSoundManager.Instance.PlayMusic(Settings.StartScreen_Music); _fader = new EasyDraw(game.width, game.height, false); _fader.Clear(Color.Black); AddChild(_fader); DrawableTweener.TweenSpriteAlpha(_fader, 1, 0, Settings.Default_AlphaTween_Duration, () => { _lockStart = false; }); }
void Update() { _easy.Clear(Color.Transparent); _easy.Fill(_bgColor); _easy.Stroke(_borderColor); _easy.StrokeWeight(_borderWeight); _easy.ShapeAlign(CenterMode.Min, CenterMode.Min); _easy.Rect(0, 0, _easy.width - _borderWeight, _easy.height - _borderWeight); _easy.Fill(_textColor); _easy.TextAlign(CenterMode.Min, CenterMode.Min); _easy.Text(_textToShow, _paddingX, _paddingY); if (_pressAnyKeyMsg != null) { _pressAnyKeyMsg.visible = _showPressAnyKeyToNext; } }
public PreGameStartScreen(string fileName, string musicFilename, OnFinished onFinished = null) : base(fileName, false, false) { if (!string.IsNullOrWhiteSpace(musicFilename)) { GameSoundManager.Instance.FadeOutCurrentMusic(); GameSoundManager.Instance.PlayMusic(musicFilename); } _fader = new EasyDraw(game.width, game.height, false); _fader.Clear(Color.Black); AddChild(_fader); _onFinished = onFinished; _lockKey = false; DrawableTweener.TweenSpriteAlpha(_fader, 1, 0, Settings.Default_AlphaTween_Duration, () => { //_lockKey = false; }); }
public void clearSelection() { _active = false; _selection.Clear(Color.Transparent); }