June 08, 2023, 02:08:45 pm

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1]

Author Topic: Spriteloader MK2  (Read 3836 times)

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki
Spriteloader MK2
« on: August 25, 2013, 05:00:05 pm »

I am 99% confident that this will not cause any weird collisions.

As Orpheon told me:
Quote
[20:23:29] The Almighty Orpheon: "By default all new sprites have their bounding boxes calculated automatically (the exact bbox will depend on the size and transparency of the sprite), however you may wish to customise this, in which case you should also use the function sprite_collision_mask."
Spriteloader didn't actually set the boundaries to what they should be, but now it does!

Code: [Select]
x = 0; //Sprite index number
while( sprite_exists(x) ) //Check that sprite exists
{
    if file_exists("Plugins/Sprites/" + sprite_get_name(x) + ".png") //Check if something in the folder has the same name as the current sprite
    {
        bboxleft = sprite_get_bbox_left(x); //Grab
        bboxright = sprite_get_bbox_right(x); //Those
        bboxtop = sprite_get_bbox_top(x); //Boundary
        bboxbottom = sprite_get_bbox_bottom(x); //Variables
        sprite_replace(x,"Plugins/Sprites/" + sprite_get_name(x) + ".png",sprite_get_number(x),true,false,sprite_get_xoffset(x),sprite_get_yoffset(x)); //Swap the sprite over
        sprite_collision_mask(x,0,2,bboxleft,bboxtop,bboxright,bboxbottom,1,0); //Set the damn boundaries properly
    }
    x += 1; //Move to the next sprite
}

Credit to Vindicator (For the actual spriteloader code), Orpheon for pointing out that GM likes to be 'helpful' and YB for pointing out the stupid mistake I made with the ordering of the bbox variables.
« Last Edit: February 18, 2014, 06:06:59 am by killercrusher232 »
Logged
My style is the best...
...so I challenge you!

therocketjumper

  • Guest
Re: Spriteloader MK2
« Reply #1 on: July 09, 2015, 09:27:33 am »

Anyway to make spriteloader support gifīs?
Logged

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki
Re: Spriteloader MK2
« Reply #2 on: July 09, 2015, 11:35:53 am »

I don't think GG2 uses any gifs anywhere
Logged
My style is the best...
...so I challenge you!

notarctic

  • just arctic, what gives?
  • ******
  • Karma: 8
  • Offline Offline
  • Posts: 4904
  • 👎👀 bad aim ba̷̶ ԁ aIm 👎 thats❌ some bad 👎👎aim
    • arcticland
Re: Spriteloader MK2
« Reply #3 on: July 09, 2015, 11:51:56 am »

Anyway to make spriteloader support gifīs?
Baby modding lesson:
Copy paste the entire plugin and change all instances of .png with .gif. No I won't provide more instruction to this dead simple task
Logged
[1:37:51 PM] Derpduck: arctic u need to quote ppl that make shit posts in case they edit them
[4:20:15 PM] Rubeus Hashgrid: i cant discover anything fuck you imageshack

therocketjumper

  • Guest
Re: Spriteloader MK2
« Reply #4 on: July 09, 2015, 12:02:10 pm »

Anyway to make spriteloader support gifīs?
Baby modding lesson:
Copy paste the entire plugin and change all instances of .png with .gif. No I won't provide more instruction to this dead simple task
I already edited the code before you told me and no, I ainīt messin around
EDIT: too lazy to test it out, might do it tomorrow
« Last Edit: July 09, 2015, 12:05:37 pm by TheRocketJumper »
Logged

Fuzion

  • Lucky Member
  • *******
  • Karma: 22
  • Offline Offline
  • Posts: 924
  • Blind asian.
Re: Spriteloader MK2
« Reply #5 on: August 30, 2015, 04:48:26 am »

gml
Logged

aronhun

  • Full Member
  • ***
  • Karma: 10
  • Offline Offline
  • Posts: 350
  • Happily retired
Re: Spriteloader MK2
« Reply #6 on: August 30, 2015, 08:01:57 am »

Can I ask two questions? Is this the thing that you can easily change almost every skin in the game and if it is, can you show me an example how does it work? I would be greatful.

notarctic

  • just arctic, what gives?
  • ******
  • Karma: 8
  • Offline Offline
  • Posts: 4904
  • 👎👀 bad aim ba̷̶ ԁ aIm 👎 thats❌ some bad 👎👎aim
    • arcticland
Re: Spriteloader MK2
« Reply #7 on: August 30, 2015, 08:21:42 am »

Can I ask two questions? Is this the thing that you can easily change almost every skin in the game and if it is, can you show me an example how does it work? I would be greatful.
spritenames into the sprites folder
example: http://puu.sh/jew10/548c81b4f0.7z
Logged
[1:37:51 PM] Derpduck: arctic u need to quote ppl that make shit posts in case they edit them
[4:20:15 PM] Rubeus Hashgrid: i cant discover anything fuck you imageshack

aronhun

  • Full Member
  • ***
  • Karma: 10
  • Offline Offline
  • Posts: 350
  • Happily retired
Re: Spriteloader MK2
« Reply #8 on: August 30, 2015, 01:17:01 pm »

Can I ask two questions? Is this the thing that you can easily change almost every skin in the game and if it is, can you show me an example how does it work? I would be greatful.
spritenames into the sprites folder
example: http://puu.sh/jew10/548c81b4f0.7z
Thanks a lot buddy. <3
Pages: [1]
 

Page created in 0.041 seconds with 36 queries.