Example #1
0
        private void showScore()
        {
            var scoreText = new GameText("+1");

            scoreText.position = position;
            scene.addEntity(scoreText);

            var moveTween = scoreText.tweenPositionTo(position + new Vector2(0, -40), deathDuration);

            moveTween.setEaseType(EaseType.QuadOut);
            moveTween.start();

            var opacityTween = new FloatTween(scoreText, 0f, deathDuration - 0.3f);

            opacityTween.setEaseType(EaseType.QuadOut);
            opacityTween.setDelay(0.3f);
            opacityTween.start();

            Core.schedule(deathDuration, t => {
                if (scene != null)
                {
                    scoreText?.destroy();
                }
            });
        }