Author Topic: [AC] rotating sprites  (Read 3085 times)

0 Members and 1 Guest are viewing this topic.

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
[AC] rotating sprites
« on: October 09, 2010, 02:59:28 pm »
Ok scrap my previous idea, way too hard D:

So new idea. Make individual sprites for the arms. legs, torso, head and all other movable body parts and just make it possible to rotate them. Now I recall that rotating a 8x8 sprite will need a 9x9 canvas in order to be able to rotate by 360 degrees. So I intend on making all the body parts 7x7. Point is, how do I rotate a 7x7 black box in axe? I am quite a newb at nearly all the physics stuff and do rotations/translations and so, (basically I suck at doing math but I wont admit it hehe) therefore if someone could come up with a small demo of a rotating 7x7 box in axe then that will help me out. I can quite easily learn from code but I would appreciate some explanation...

I hope I don't sound too demanding but I just need a memory and cpu efficient way to handle all the animations in AC and this method seems to be the golden midway...

May thanks!
« Last Edit: October 09, 2010, 03:45:21 pm by matthias1992 »
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AC] rotating sprites
« Reply #1 on: October 09, 2010, 04:07:39 pm »
For such small sprites, it would probably be easier and take up less space (and definitely be faster) to just have pre-rendered sprites for different rotation angles, instead of calculating and drawing rotated sprites on the fly.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: [AC] rotating sprites
« Reply #2 on: October 09, 2010, 04:25:29 pm »
You can write a program that takes an initial sprite and then rotates it 30 or 22.5 degrees each time and then exports the hex code for every rotation.  It might be a little complicated to write, but speed isn't an issue since you're just pregenerating them.  It would be a useful program for a lot of people actually. Maybe I should write one in Axe unless anyone else wants to give it a shot?
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: [AC] rotating sprites
« Reply #3 on: October 09, 2010, 04:31:45 pm »
@Runer yea maybe I should have them pre-made...good idea.
@Quigibo, an excellent idea! Personally I have far too much projects in parallell to take on the challenge plus, I suck at mathematics in general...
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AC] rotating sprites
« Reply #4 on: October 09, 2010, 05:17:55 pm »
You can write a program that takes an initial sprite and then rotates it 30 or 22.5 degrees each time and then exports the hex code for every rotation.  It might be a little complicated to write, but speed isn't an issue since you're just pregenerating them.  It would be a useful program for a lot of people actually. Maybe I should write one in Axe unless anyone else wants to give it a shot?

I'm giving it a shot. I'm using the best algorithm I can find without anti-aliasing.
« Last Edit: October 09, 2010, 05:18:30 pm by Runer112 »

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55821
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: [AC] rotating sprites
« Reply #5 on: October 09, 2010, 05:33:57 pm »
It would be nice! Make sure to write a small tutorial on how to use it, though ;)
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AC] rotating sprites
« Reply #6 on: October 09, 2010, 11:39:34 pm »
The first step to a really good sprite rotating algorithm: a really good sprite upscaling algorithm. ;D

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55821
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: [AC] rotating sprites
« Reply #7 on: October 09, 2010, 11:59:26 pm »
O.o did you generate this with a program? It looks nice :O
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: [AC] rotating sprites
« Reply #8 on: October 10, 2010, 12:00:35 am »
that in itself would be very useful to have!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8206
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: [AC] rotating sprites
« Reply #9 on: October 10, 2010, 12:02:51 am »
Didn't someone write a routine somewhere to magnify an entire screen?

And yeah, that does look useful. Can we have the code? ;D




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AC] rotating sprites
« Reply #10 on: October 10, 2010, 12:06:24 am »
O.o did you generate this with a program? It looks nice :O

Yes, in Axe. Now that I have upscaling working, I need to tackle rotation.


that in itself would be very useful to have!

I'm not really sure what it would be useful for, as the process is slow and takes about 3 seconds.


Didn't someone write a routine somewhere to magnify an entire screen?

And yeah, that does look useful. Can we have the code? ;D

Yes, I believe I wrote the routine you're referring to. ;)

And when I've completed it, I'll give it out. But rotating still has to be implemented.
« Last Edit: October 10, 2010, 12:15:13 am by Runer112 »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: [AC] rotating sprites
« Reply #11 on: October 10, 2010, 12:09:22 am »
Didn't someone write a routine somewhere to magnify an entire screen?

And yeah, that does look useful. Can we have the code? ;D

Ya, Raylin asked a bit ago for one so DJ wrote one that does it actively and mine takes a a sprite and just displays the result. I don't remember where that thread is though.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55821
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: [AC] rotating sprites
« Reply #12 on: October 10, 2010, 12:09:59 am »
Darn if that was faster it would rule for games with rotating ships or even rotating maps, like in Kartingz for 68k calcs.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: [AC] rotating sprites
« Reply #13 on: October 10, 2010, 12:10:24 am »
hmm, 3 seconds is a little long. however, it would still be useful for learning from(and for being able to look at pretty things) and may make resizes of peeps easier(although i can just use paint for that, i guess). good luck with rotation.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8206
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: [AC] rotating sprites
« Reply #14 on: October 10, 2010, 12:11:58 am »
Darn if that was faster it would rule for games with rotating ships or even rotating maps, like in Kartingz for 68k calcs.

Yeah, that's too bad. Otherwise, squidgetx could use that in Cuberunner...