Thread: Loading Custom Sprites - Explained[Refactored]

Results 1 to 3 of 3
  1. #1 Loading Custom Side Icons- Explained[Refactored] 
    ZachHaley
    Guest
    OK, most people have this, but if you are using a 317 deob like me, you don't have it. So I am going to tell you and teach you how its done.

    The 317 Deob by default uses the Background class to load its Side Icons, and to position them.

    The positioning is done by using the method 361 in the Background class.

    The loading of the Side Icons is done by using the following line:
    Code:
    sideIcons[j3] = new Background(streamLoader_2, "sideicons", j3);
    j3 is a variable declared in a for loop.
    Code:
    for(int j3 = 0; j3 < 13; j3++)
    				sideIcons[j3] = new Background(streamLoader_2, "sideicons", j3);
    As you can see, j3 can only go from 0 to 12. Meaning that there are 12 Side Icon sprites.

    The Side Icons are added when the following is called:
    Code:
    sideIcons[0].method361(29, 13);
    This is when the icon is placed on the game interface. 29 being the X, 13 being the Y.

    Now, to make the custom icons load, you need to load them from the Sprite class, which can be done by changing the following:
    Code:
    private Background[] sideIcons;
    sideIcons = new Background[13];
    sideIcons[j3] = new Background(streamLoader_2, "sideicons", j3);
    to
    Code:
    private Sprite[] sideIcons;
    sideIcons = new Sprite[13];
    sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
    But this is not all that must be done, if you do this you will get an error because method361 does not exist in the Sprite class. So you need to have a substitute for that method(this method positions the sprites).

    If you change method361 to method346, you will have it all fixed and loading correctly.

    Make sense? Good.

    Now to load the sprite from this, you need to add the following into the Sprite constructor.
    Code:
    if (s.contains("sideicons"))
    		{
    			try
    			{
    				Image img = Toolkit.getDefaultToolkit().getImage("./Sprites" + s + ".png");
    				myPixels = new int[myWidth * myHeight];
    				PixelGrabber pixelgrabber = new PixelGrabber(img, 0, 0, myWidth, myHeight, myPixels,
    						0, myWidth);
    				pixelgrabber.grabPixels();
    			} catch(Exception e)
    			{
    			}
    		}
    This code will load the sideicons 0, sideicons 1, sideicons 2, ext ext from the Sprites folder.

    Does it all make sense now? If not, ask a question...

    Notes:

    If method346 doesn't work, try drawSprite or drawSprite1



    P.S, I haven't fully tested, because I don't have any side icons to change yet, but this should work.
    Last edited by ZachHaley; 02-20-2009 at 06:38 AM. Reason: Changed Title
     

  2. #2  
    Registered Member
    `Tom's Avatar
    Join Date
    Oct 2008
    Age
    27
    Posts
    299
    Thanks given
    1
    Thanks received
    2
    Rep Power
    81
    Can you revert this to non-refacoted please?
    Stop whackin' it and read what I posted.
     

  3. #3  
    I'm Back

    Stewie's Avatar
    Join Date
    Jul 2008
    Age
    26
    Posts
    7,989
    Thanks given
    1,877
    Thanks received
    1,491
    Rep Power
    5000
    Quote Originally Posted by `Tom View Post
    Can you revert this to non-refacoted please?
    why bump this but its fairly simple to convert.
    just change all of these:
    Code:
     = new Sprite(******)
    into this:
    Code:
     = new Class30_Sub2_Sub1_Sub1(******)
    and these:
    streamLoader_2
    into this:
    class44_2

    and this:
    sideIcons[]
    is
    anInt947;

    Background is this:
    Class30_Sub2_Sub1_Sub2[]

    sprite code is this:
    [code]
    if (s.contains("sideicons"))
    {
    try
    {
    Image img = Toolkit.getDefaultToolkit().getImage("./Sprites" + s + ".png");
    anIntArray1439 = new int[anInt1440 * anInt1441];
    PixelGrabber pixelgrabber = new PixelGrabber(img, 0, 0, anInt1440, anInt1441, anInt1439,
    0, anInt1440);
    pixelgrabber.grabPixels();
    } catch(Exception e)
    {
    }[code]
    }


    [Only registered and activated users can see links. ]
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •