Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Does anyone know GML code for palette swapping?  (Read 3844 times)

0 Members and 1 Guest are viewing this topic.
Does anyone know GML code for palette swapping?
« on: June 14, 2012, 06:00:27 am »
  • Make your best move ass-bite!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 139
So, I'm making a game, I need to know if there's a way to switch the color palette of a sprite...
Thanks in advance!  XD
Logged

DaSpirit

The Quiet
Re: Does anyone know GML code for palette swappi...
« Reply #1 on: June 14, 2012, 01:07:47 pm »
  • The Mad Programmer.
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 87
I could make a code. It would be very slow (due to GM's pixel functions naturally being slow) and would require the registered version of GameMaker. As long as you don't do it real time, it'd be fine. Is that good?
Logged
I support:
Re: Does anyone know GML code for palette swappi...
« Reply #2 on: June 14, 2012, 05:58:36 pm »
  • Make your best move ass-bite!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 139
Yes that is fine
Logged

Zhello

N.A.D.I.
Re: Does anyone know GML code for palette swappi...
« Reply #3 on: June 14, 2012, 06:11:54 pm »
  • L'homme avec beaucoup de noms.
  • *
  • Reputation: +6/-1
  • Offline Offline
  • Gender: Male
  • Posts: 925
If it is for swapping background, there was a LoZ:seasons example somewhere here.  Thats what your looking for?
Logged
The IT Guy
Intermediate Coder
Linux is a wonderful thing
~Linkwolf48/Gumstone1080~

The Legend of Zelda - New Beginnings

http://zfgc.com/forum/index.php?topic=34986.0
1.6 Demo -
https://www.dropbox.com/s/56km0iadaras56g/LoZNB%20Game%20Folder.rar?dl=0


Side Projects:

Dragon Diary - Cybernetic Threat
Story: http://wiki.zfgc.com/Cybernetic_Threat

Quote
Aero88
ZFGC is like the Hotel California.  You can come in but you can never leave!

devianart: http://linkwolf48.deviantart.com/
Re: Does anyone know GML code for palette swappi...
« Reply #4 on: June 14, 2012, 06:22:49 pm »
  • Make your best move ass-bite!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 139
It's actually a sprite for Link, swapping the palette when he is hurt.
Logged

DaSpirit

The Quiet
Re: Does anyone know GML code for palette swappi...
« Reply #5 on: June 14, 2012, 06:50:23 pm »
  • The Mad Programmer.
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 87
Here you go.

Refer to the object for an example on how to use these scripts.

As I have said earlier, it is slow, as GM's get pixel functions are naturally so. I made it so that it saves all pixels beforehand so it's useful if you're swapping multiple colors, but slower if you are only swapping a single color. Regardless, the order of magnitude is potentially smaller.

Credit is not necessary but appreciated. If you need any changes to the scripts, you can simply post again here or send me a PM.
« Last Edit: June 14, 2012, 06:52:02 pm by DaSpirit »
Logged
I support:
Re: Does anyone know GML code for palette swappi...
« Reply #6 on: July 10, 2012, 02:52:10 pm »
  • 笑い男
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2124
Unless you need to change between many quite random pallets of many things, then you may be better off creating those sprites beforehand (I'm sure you can do pallet swaps extremely easily in any good graphics editor) and then loading them into the game. Use more memory and less cpu, or use more cpu and less memory, that is the question :p (GM also used to have a built in function for this in its past versions which disappeared around 7 I think. No idea what it has no though.)
Logged

この世に悪があるとすれば、それは人の心だ
  • .hack//The World
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.189 seconds with 50 queries.