Watch my video on YouTube: https://www.youtube.com/watch?v=fJxZyHArSKA
This is a beginner's YouTube tutorial that introduces sine waves and how they can be used to give sprites a fake 3D spinning effect in GameMaker Studio 1 & 2.
Sine waves are oscillating curves with their cycle ranging from 0 to 2pi. They're also functions. So if we plug in x, where we currently are positioned in the cycle, we get an output value of y, where this output ranges from -1 to 1. Applying this output value to a sprite's horizontal scale, its image_xscale, simulates a spinning effect. In reality, all that's happening is the sprite is horizontally either growing or shrinking. Further, based on this output, we can decide which frame of the sprite, which image_index, to show: the front side of the coin or the back side of the coin.
A sprite's image_yscale can also be manipulated to give the appearance of it flipping vertically rather than spinning. Sprites with non-centered origins make the effect a little more obvious with what's happening. Coupling spinning with rotation can make for an even stronger faux 3D effect.
This tutorial assumes that the viewer has basic knowledge of GameMaker Studio and can work their way around the interface. A grasp of sprites, objects, and object events are also necessary to follow along.
If you found this tutorial useful and want to see more like it in the future, don't forget to like and subscribe! Feel free to leave a comment below with a suggestion for a topic that you'd like to see me cover in a future video.
Assets provided by the wonderful Kenney! http://kenney.nl