安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题
I'm actually pretty shocked by this. I figured that since it was easily doable in the sprite editor there would likely be some form of sprite, color, or draw function that would allow you to do it.
I was hoping to have my units have a part of them showing the color of the player that is in control of them. Currently I have seperate sprites for each player color, but now that I'm at the point of having to actually do various animations and things its just turning into a massive chore and a huge amount of sprites despite not having many different types of units in my game.
If I further broke my objects down into more objects, a pre-determined color part of the object and a part that is easily altered by blending, then I'd end up having even more sprites and having even more things to have to coordinate together during animation.
I kinda pity anyone making an RPG or anything similar since they wouldn't be able to just do simple color swapping, but have to actually make entirely new sprites. Ouch.
I've tried looking into the idea of using shaders for it since from what I've read it sounds like thats a way to do it... unfortunately I can't find anyone actually giving understand information on how it works and how to make and use shaders.
All I've managed to find is people showing off what shaders can do or providing their own shaders. No explaination of how I can go about making any to suit my needs though.
Even tried to figure out the shaders demo that comes with Gamemaker since that has a thing on color swapping, but it didn't really explain anything about how its working. All I could gather is that it was able to take the color of pure white in an image and swap it to red. No idea about how to do things with a tolerance range or anything of the sort.
so the draw event would look like this.
If you can get shaders to work that would be easier to do what you want to, and I bet it isnt even that hard to do. Using shaders you can probably check the color of a pixel and change it to be whatever color you want if it's equal or close enough to your desired color. Or even have a 'green screen' effect with that particular color.
Yeah I could do it with a grayscale version of what I want to have various colors and then just draw over it, or under it, the parts that I don't want to ever change colors. I had considered doing that but it would mean having to deal with objects that are two parts and having them animate together which I was trying to avoid in this project.
If it comes down to it I may do it that way or just leave it as I have it currently where the team colors are hard coded and using their own seperate object / sprite.
I can understand the concept, but its the execution I'm having trouble fully grasping. I'm used to the concept of replacing one specific color or even a general hue, governed by a tolerance, from working with art programs. I'm just having some trouble managing to wrap my head around making a shader to do that.
Actually, I had found a shader that does exactly what I need in every way. It was posted up in this thread at YoYo Games ( YoYo Games Forum [gmc.yoyogames.com]).
Sadly though, while the shader itself performs the exact functions I need I haven't been able to figure out how to use it properly in my project. I see the four arguments I need to pass into it, but trying to do it like it shows in the manual hasn't panned out for me.
There is a example project to demonstrate the shader in action even, but all that did was further confuse me.
For reference, here is the coding of the shader from that thread.
Basically though, it was like this. The inputs for the shader are...
I based my coding off what I saw in the manual in regards to shaders. In the create event of my controller object I had...
Then in the draw event of my objects I had this...
If I recall correctly, my error messages were in relation to the input I was putting in. I'm under the impression that I wasn't properly using the "shader_set_uniform_f" function, but never managded to figure out what I was doing wrong.
I'll give it a shot.
I tried adding in a fourth value for the Color In, Out, and Tolerance. Same results. No errors or anything, but no results.
Thanks for the suggestion to try though.
I'm trying to pick apart the example project for that shader still. Its a bit of a pain for me since the example was meant more to demonstrate the capabilities and limitations of the shader and not actually to teach you how to use it.
UPDATE - Seems the example project is using a slightly modified shader code than the one that its an example of. It also uses two additional scripts that seem to do something with setting the color and getting the rgba values for... well no idea really.
I managed to get the examples shader and script coding in my own project and not erroring out, but still not change what-so-ever in my objects sprites.
I had stupidly been using my colorIn and colorOut as a Hue, Saturation, Value, and Alpha input. It seems the shader, at least the one from the example, wants RGBa input for the colorIn and ColorOut.
So managed to actually get results, quite close to what I wanted. Now I just need to actually pick everything apart and try to actually fully understand it so I can hopefully implement it in a way thats actually functional for my own project and not as "hackey" and butchered into place.
Thanks again for the responses. Helped to get my brain on track and at least get close enough to my goal that I think I can get it going in the end.
Seems kinda pointless to just bring back this old thread without making any form of contribution to it.