Change size of 32x32 Sprite?

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

  1. Ray =D
    OP

    Ray =D GBAtemp Regular

    Member
    288
    38
    May 17, 2011
    Gambia, The
    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

    LeRodeur GBAtemp Regular

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

    Ray =D GBAtemp Regular

    Member
    288
    38
    May 17, 2011
    Gambia, The
    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

    LeRodeur GBAtemp Regular

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

    CoolAs Advanced Member

    Newcomer
    75
    17
    Oct 21, 2011
    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

    LeRodeur GBAtemp Regular

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

    Schmendrick Advanced Member

    Newcomer
    55
    3
    Sep 12, 2009
    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

    huiminghao GBAtemp Regular

    Member
    175
    20
    Mar 6, 2011
    Switzerland
    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

    iSubaru Kitsune

    Member
    360
    18
    Apr 14, 2009
    Poland
    Gensokyo
    What about just rescalling image to 16x16 in paint or other program and then load to Your project ;) :P
     
  10. iDallin

    iDallin Newbie

    Newcomer
    9
    0
    Jan 22, 2012
    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

    iSubaru Kitsune

    Member
    360
    18
    Apr 14, 2009
    Poland
    Gensokyo
    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

    Ray =D GBAtemp Regular

    Member
    288
    38
    May 17, 2011
    Gambia, The
    No its for 2D-craft ds D: But I dont need it anymore. Still, thank you all for ya help :D