GameMaker Rotate Object, then scale it?

O

Orion31

Guest
I have a circular sprite that I want to rotate under a person.
upload_2020-1-31_23-38-57.png

To do this I draw it with 0.2 image_yscale and keep subtracting from image_angle each frame. That gives me this:
https://imgur.com/a/0y6Nb4P

I think it is first shrinking the sprite and then rotating it, however, I want it to rotate first and then shrink (so it looks like its on the ground the player is standing on). Is this possible?
 

sinigrimi

Member
I have a circular sprite that I want to rotate under a person.
View attachment 28534

To do this I draw it with 0.2 image_yscale and keep subtracting from image_angle each frame. That gives me this:
https://imgur.com/a/0y6Nb4P

I think it is first shrinking the sprite and then rotating it, however, I want it to rotate first and then shrink (so it looks like its on the ground the player is standing on). Is this possible?
if you change image_yscale and do not alter image_xscale equally, your image will no longer be on equal sides (the circle will not be round). And you get what you attached in the file below.
 
O

Orion31

Guest
if you change image_yscale and do not alter image_xscale equally, your image will no longer be on equal sides (the circle will not be round). And you get what you attached in the file below.
I want the circle to look like an oval so it looks like the character is standing on top of it but I want the oval to spin on the z axis
 

rIKmAN

Member
You don't need a shader or 3D to do this, just draw your sprite as a regular flat circle and whatever look / design you want it to have, then rotate it in whatever increments you want for a full (or half if it's symetrical) rotation and export the frames.

When drawing in GMS make sure the depths are such that it draws behind the character and use draw_sprite_stretched() to squash it and make it appear oval.

Here's a quick example I just did using the above method and using 30 degree increments of rotation for each frame, with a total of 7 frames.


 
O

Orion31

Guest
You don't need a shader or 3D to do this, just draw your sprite as a regular flat circle and whatever look / design you want it to have, then rotate it in whatever increments you want for a full (or half if it's symetrical) rotation and export the frames.

When drawing in GMS make sure the depths are such that it draws behind the character and use draw_sprite_stretched() to squash it and make it appear oval.

Here's a quick example I just did using the above method and using 30 degree increments of rotation for each frame, with a total of 7 frames.


Okay, thanks so much. I thought I would have to make tons of frames for it to look smooth, but even with 7 it looks pretty good.
 

rIKmAN

Member
Okay, thanks so much. I thought I would have to make tons of frames for it to look smooth, but even with 7 it looks pretty good.
I only had to rotate the circle halfway until the gaps matched back up as the icon is symetrical, but it would be more if that wasn't the case.
 
O

Orion31

Guest
I only had to rotate the circle halfway until the gaps matched back up as the icon is symetrical, but it would be more if that wasn't the case.
Right, that makes sense. I really miss judged how tedious it would be.
 

rIKmAN

Member
Right, that makes sense. I really miss judged how tedious it would be.
What software are you using?
There should be a rotate option somewhere, usually in the transform menu or similar.

Inkscape might be best for free software as it's vector based so the rotation will be smoother than pixel art.

I can post you my frames if you want them, though not sure if they'd be the right size as I just threw them together quickly to show the example.
 
O

Orion31

Guest
What software are you using?
There should be a rotate option somewhere, usually in the transform menu or similar.

Inkscape might be best for free software as it's vector based so the rotation will be smoother than pixel art.

I can post you my frames if you want them, though not sure if they'd be the right size as I just threw them together quickly to show the example.
No, that's ok. Thanks for the offer tho. I have a 512x512 version in Photoshop. It shouldn't be too hard for me to do ;)
 

rIKmAN

Member
Wait why not?
Well it depends on your resolution, but 512x512 would take up half the vertical space and a quarter of the horizontal space on a 1920x1080p screen.
It'd be a bit smaller vertically when squashed to be oval, but if each frame is that big and you have 10+ of them that's an awful lot of wasted texture space for a simple rotating circle.

It's like someone wondering what the problem is with their 2000x2000 character sprite which has 25 frames just for the idle animation.
 
O

Orion31

Guest
Well it depends on your resolution, but 512x512 would take up half the vertical space and a quarter of the horizontal space on a 1920x1080p screen.
It'd be a bit smaller vertically when squashed to be oval, but if each frame is that big and you have 10+ of them that's an awful lot of wasted texture space for a simple rotating circle.

It's like someone wondering what the problem is with their 2000x2000 character sprite which has 25 frames just for the idle animation.
Oh I think I misunderstood what you meant. I thought u meant that there was something wrong with big images in gamemaker
 

rIKmAN

Member
Oh I think I misunderstood what you meant. I thought u meant that there was something wrong with big images in gamemaker
No not "wrong", just unnecessary in the majority of cases as people don't take resolution and sprite size into account before they start making them and then have issues down the road caused by massively oversized sprites.
 
O

Orion31

Guest
No not "wrong", just unnecessary in the majority of cases as people don't take resolution and sprite size into account before they start making them and then have issues down the road caused by massively oversized sprites.
What's the difference between resolution and sprite size. I thought resolution just affects printing sinces it's dots per inch
 

rIKmAN

Member
What's the difference between resolution and sprite size. I thought resolution just affects printing sinces it's dots per inch
If the base resolution of your game is say 640x360, then a 512x512 sprite for a circle under a characters feet doesn't make sense as it's bigger than the entire game window.
If it's 1280x720 then it's almost the whole vertical space.

If your base resolution is 1920x1080 it will fit on screen but then how big are the characters if that 512x512 sprite is just going around his feet?
Does that leave enough room for the rest of the "game" and level around the characters to do whatever you are wanting to do?

Maybe it does, I'm not sure what your game is all about or what you are aiming for, but generally you want your sprites to be the correct size for the base resolution of your game and then scale things up or down as needed from there for different resolutions with relevant solutions to prevent stretching (black bars, expanding the viewable level etc)
 
O

Orion31

Guest
If the base resolution of your game is say 640x360, then a 512x512 sprite for a circle under a characters feet doesn't make sense as it's bigger than the entire game window.
If it's 1280x720 then it's almost the whole vertical space.

If your base resolution is 1920x1080 it will fit on screen but then how big are the characters if that 512x512 sprite is just going around his feet?
Does that leave enough room for the rest of the "game" and level around the characters to do whatever you are wanting to do?

Maybe it does, I'm not sure what your game is all about or what you are aiming for, but generally you want your sprites to be the correct size for the base resolution of your game and then scale things up or down as needed from there for different resolutions with relevant solutions to prevent stretching (black bars, expanding the viewable level etc)
Oh I thought u meant ppi resolution like what you define in Photoshop not game resolution. My character is 512 512 but even from there I scale it down the further it is from the camera so I just made it so that the ring scales itself down based on the size of the player.
 

rIKmAN

Member
Oh I thought u meant ppi resolution like what you define in Photoshop not game resolution. My character is 512 512 but even from there I scale it down the further it is from the camera so I just made it so that the ring scales itself down based on the size of the player.
Haha no I meant game resolution.

I just thought I'd mention it as like I said a lot of people don't even think about it and hit problems later because they didn't know that using a 2000x2000 character sprite would be a problem and wonder why it crashes on mobile or causes 300 texture swaps or any of the other issues it can cause.

Good luck with the game!
 
O

Orion31

Guest
Haha no I meant game resolution.

I just thought I'd mention it as like I said a lot of people don't even think about it and hit problems later because they didn't know that using a 2000x2000 character sprite would be a problem and wonder why it crashes on mobile or causes 300 texture swaps or any of the other issues it can cause.

Good luck with the game!
Thank you for telling me. I didn't even think that large sprites could cause problems but it's good to know.
Thank you for your help!
 
Top