• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Asset - Objects I made a pretty cool asset, how to sell? (PIXEL PERFECT SPRITE ROTATION)

Hi everyone,

I've been busy with game maker for the past 6 months. I'm actually trying to make my
own little games, and try and see what valuable systems, graphics,... and so on
I make alongside that learning process. For now, I'm not planning to release an actual game,
but there is a gameproject I'm working on that "could" turn into one.

I have however, made quite a lot of assets (way too much for me to use in a game). When I feel ready to publish those, I will. Currently, I have one that is pretty much done. I was wondering exactly what I should pay attention to when publishing, and what steps to follow. I'm very new to selling things on
the marketplace, have never done it before.

Quick note about myself: I'm a chemist, engineer, and sort of a mathnerd. I used my skills
I learned in math and engineering to craft a system to rotate sprites any way you like. I basically made a trigonometry-machine for this :p

What I noticed is that you can rotate sprites in-game, by having a sprite's
draw event use something like draw_sprite_ext, in which you have a "rot" value that
you can increment to cause rotation. However, this rotation happens around the sprite asset
center. No problem if you want to import each and every sprite, then set each and every sprite's
origin point, then just draw it using draw_sprite_ext. Quite a lot of boring importing work if you ask me.

You can also just import an entire spritesheet, containing all the sprites you want. Using
draw_sprite_general you can then select which part of the spritesheet needs to be drawn:
by using a top x, top y, width and height. Very nice! A lot less importing! However,
these sprites that are drawn this way will have their origin point set in the top left corner,
no longer anywhere you like!!!

So there's a dilemma: I would like to use spritesheets and draw parts of those, and make my sprites rotate.
However, I can't set my sprite point origin points anywhere I like anymore...

Solution:
Well guess what :D
I did it; quite a lot of math but the end result is actually a very basic minimum of formulas. Draw a sprite from a spritesheet, then choose to rotate it any way you want.

Oh and by the way, just for fun: i included a "pixel perfect" camera to make all rotations not seem "jaggy" ;)


All you, as a creator, have to do is input the absolute minimum of required values:
sprite coordinates (you still have to use draw_sprite_part, draw_sprite_general,... naturally)
=> 4 numbers (x, y, width, height)

As well as:
x offset point for a new origin point, of your own choosing
y offset point for a new origin point, of your own choosing
rotation speed (just a number)
rotation path (also just a number)
=> 4 numbers

So with 8 values: you can have any pivot point you want, for a sprite drawn from a single spritesheet.
No more need for importing each one, then setting each one's origin! Also a lot nicer when it comes to asset management if you ask me.


I did include a lot more values you can mess around with. Pretty much everything you can manipulate of a sprite is in the project, but not necessary (things like color, transparency, xscale, yscale,...).


I'm currently making the "behind the scenes" mathematical explanation of it all, trying to write it
clearly and readable on a single page. If that's done I will include that in the project that I want to sell. It's not enough for me to sell something that works perfectly, i also want to give people the opportunity to actually understand WHY it works.
It's really... a thing of beauty, the way this math works, especially if you consider how little lines of code are needed (20 lines in step event, 12 in draw event, + a bunch of variables in the create event).
The actual math that causes everything to work is in the step event, and it's not really 20 lines,
more like 9 if i remove comments and make the code more compact, but then it would be less readable).


So back to the question:

Any tips, any steps I need to absolutely make sure of I don't mess up? This is finances after all.
 
Last edited:
Top