Page 1 of 1

Upcoming RPG

Posted: August 22nd, 2017, 3:21 pm
by goldengamesTM
I've caught up on the tutorials and with the release of the new tutorial, I have most of the materials to make an RPG. I'm waiting the transparency vid, because I tried to improvise, and well, this happened.
You can enter buildings and move to new areas by touching the edge, use wasd to move by the way.

Re: Upcoming RPG

Posted: August 22nd, 2017, 3:38 pm
by goldengamesTM
I'm an idiot and forgot to add the file the correct file the first time.

Re: Upcoming RPG

Posted: August 23rd, 2017, 12:57 am
by albinopapa
It appears you are wanting to use something called chroma key, or color key transparency. Since chili's color class has getters for the different color channels, why not loop through the sprite and if color == color key value skip it.

Just make a new DrawSprite function in Graphics.

Code: Select all

void DrawSprite( int xOffset, int yOffset, Surface &Surf, Color Key )
{
     const unsigned char keyred = Key.GetR();
     const unsigned char keygrn = Key.GetG();
     const unsigned char keyblu = Key.GetB();
     for(int y = 0; y < Surf.GetHeight(); ++y)
     {
          for(int x = 0; x < Surf.GetWidth(); ++x)
          {
               const pixel = Surf.GetPixel(x, y);
               if(!(pixel.GetR() == keyred && pixel.GetG() == keygrn && pixel.GetB() == keyblu))
               {
                    PutPixel(x + xOffset, y + yOffset, pixel);
               }
          }
     }
}

Re: Upcoming RPG

Posted: August 23rd, 2017, 1:26 am
by chili
Pretty much exactly what I do in Intermediate 11, except I add ==, != operators to Color.

RPG game sounds fun, hope to see some progress! I11 will add drawing subregions, clipping, chroma
I12 is about animated sprites, and I13 will be about drawing text. Should all be useful for you project.

Re: Upcoming RPG

Posted: August 23rd, 2017, 3:39 am
by goldengamesTM
chili wrote:and I13 will be about drawing text. Should all be useful for you project.
You project?

Re: Upcoming RPG

Posted: August 23rd, 2017, 4:46 am
by albinopapa
^^Trollin' Chili?
lol

Re: Upcoming RPG

Posted: August 23rd, 2017, 2:55 pm
by goldengamesTM
Yep... 8-)

Re: Upcoming RPG

Posted: August 23rd, 2017, 3:13 pm
by goldengamesTM
Thanks Albinopapa! I had to do some tweaking to your code to get it to work, but hey man, it works!

Re: Upcoming RPG

Posted: August 23rd, 2017, 7:00 pm
by albinopapa
Good deal.

Re: Upcoming RPG

Posted: August 26th, 2017, 7:28 am
by OrbitalReign
Nice idea, I like how you did the other areas to go to though I did get lost for a second. I think I played the version without the chroma key thing but much cool.