Checking off my list of vital features before an alpha test release, today I implemented a system for keeping track of which collectible items (upgrades and the like) are still available to collect. And I implemented collecting one of them, the propulsion wheel:
I’m not quite happy with the collection announcement yet — I think it needs a little more tweaking before I’m done with it.
For you aspiring game developers reading this and wondering how I got the 2-d sprite to appear to rotate about the y-axis, it’s pretty simple. Like most tricks of this nature, it just involves a little trigonometry:
bool reversed = _rotationTimer > RotationTimeMs / 4 && _rotationTimer < 3 * RotationTimeMs / 4; Vector2 scale = new Vector2((float) Math.Abs(Math.Cos(_rotationTimer / RotationTimeMs * Math.PI * 2)), 1f); spriteBatch.Draw(texture, displayPosition, null, Player.Instance.Color, 0f, origin, scale, reversed ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
Basically I'm periodically shrinking the image down in the X dimension, then bringing it back to full size, while also flipping the image horizontally for half of the rotation. The trig functions make it look like it's actually smoothly rotating because the unit circle yo.
Tomorrow I've decided to tackle drawing the sprite sheets for the surface of the planet. I also think I might need to shift the entire Tiled map over and down some... all the layers of it. Hopefully that's not such a horrible task as to require me to write a program to do so.