Change size of 32x32 Sprite?

Discussion in 'NDS - Emulation and Homebrew' started by Ray =D, Dec 27, 2011.

Dec 27, 2011

Change size of 32x32 Sprite? by Ray =D at 11:56 AM (1,538 Views / 0 Likes) 11 replies

  1. Ray =D
    OP

    Member Ray =D GBAtemp Regular

    Joined:
    May 17, 2011
    Messages:
    288
    Country:
    Germany
    Hey!
    I want to ask if its possible to scale sprites in DS Homebrews. I want to resize my 32x32 sprite to 16x16. And I'm using libnds.
    I hope someone can help me :D
     
  2. LeRodeur

    Member LeRodeur GBAtemp Regular

    Joined:
    Dec 12, 2009
    Messages:
    162
    Country:
    France
    Maybe using a buffer and doing something like
    For (i=0;i
     
  3. Ray =D
    OP

    Member Ray =D GBAtemp Regular

    Joined:
    May 17, 2011
    Messages:
    288
    Country:
    Germany
    Hmm... I have no gbatek examples :D Only the libnds examples. But there is a demo which shows scaling. The problem is, it shows scaling with BG's. Is it possible with sprites, too? :P *Sounds like a noob xD*
     
  4. LeRodeur

    Member LeRodeur GBAtemp Regular

    Joined:
    Dec 12, 2009
    Messages:
    162
    Country:
    France
    Well yes the way I told you by using a buffer spite.
    Don't really know other way
     
  5. CoolAs

    Newcomer CoolAs Advanced Member

    Joined:
    Oct 21, 2011
    Messages:
    75
    Country:
    Australia
    Can you tell me what you need this for?

    Scaling sprites is something that you can not do with hardware and you can not easily do it with software...

    But yeah, the way thatLeRodeur said would be the easiest. (but it does not blend the colours properly)
    Although you could use the 3D engine, but if you do that then I can not help you as I have never used that part of the DS properly...
     
  6. LeRodeur

    Member LeRodeur GBAtemp Regular

    Joined:
    Dec 12, 2009
    Messages:
    162
    Country:
    France
    or you could take a look at this http://dev-scene.com/NDS/Tutorials/Captain_Apathy/Tiling
     
  7. Schmendrick

    Newcomer Schmendrick Advanced Member

    Joined:
    Sep 12, 2009
    Messages:
    55
    Country:
    Netherlands
    If you wish to use the 3D engine, take a look at relminator's Easy GL2D lib (http://forum.gbadev.org/viewtopic.php?t=17417). It's easy enough to use, very tiny and allows you to do a ton of things with sprites. It also comes with examples.
     
  8. huiminghao

    Member huiminghao GBAtemp Regular

    Joined:
    Mar 6, 2011
    Messages:
    175
    Country:
    China
    This answer is yes, but the scale function is limited.
    Take a look at http://nocash.emubase.de/gbatek.htm#lcdobjoamattributes

    with the reg of OBJ Attribute 0 (R/W)
    you should enable the Rotation/Scaling Flag
    with the reg of OBJ Attribute 1 (R/W)
    you should set a number 0~31 for bit 9-13, which determines the 'Scaling Parameters'

    for the 'Scaling Parameters', here is the description:
    Location of Rotation/Scaling Parameters in OAM
    Four 16bit parameters (PA,PB,PC,PD) are required to define a complete group of Rotation/Scaling data. These are spread across OAM as such:

    1st Group - PA=07000006, PB=0700000E, PC=07000016, PD=0700001E
    2nd Group - PA=07000026, PB=0700002E, PC=07000036, PD=0700003E


    You should check the BG scaling for the meanings of PA,PB,PC,PD.
    e.g. if PA=0x100, PB=0, PC=0, PD=0x100, the picture shows what it is.
    if PA=0x80, PB=0, PC=0, PD=0x80, the size of picture would be half of the original(32x32 -> 16x16)

    So, there are only 32 scaling groups, that is what limited.
     
  9. iSubaru

    Member iSubaru Kitsune

    Joined:
    Apr 14, 2009
    Messages:
    358
    Location:
    Gensokyo
    Country:
    Poland
    What about just rescalling image to 16x16 in paint or other program and then load to Your project ;) :P
     
  10. iDallin

    Newcomer iDallin Newbie

    Joined:
    Jan 22, 2012
    Messages:
    9
    Country:
    United States
    On paint copy the sprite , go to resize and pixels, it should say 32 by 32 change that to 16 by 16, I assume this is for the jazz jackrabbit game? Lol appreciate it
     
  11. iSubaru

    Member iSubaru Kitsune

    Joined:
    Apr 14, 2009
    Messages:
    358
    Location:
    Gensokyo
    Country:
    Poland
    Bite me, Tileset for Jazz Jackrabbit fits into 32x32 and it can be left that way, the Jazz character is diffrent story, in some cases it fits in 32x32 but in some others You must use 64x64 or 64x32 or 32x64 OR cut/resize/scale/whatever-that-breaks-img-awesomeness
     
  12. Ray =D
    OP

    Member Ray =D GBAtemp Regular

    Joined:
    May 17, 2011
    Messages:
    288
    Country:
    Germany
    No its for 2D-craft ds D: But I dont need it anymore. Still, thank you all for ya help :D
     

Share This Page