Upcoming RPG

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
goldengamesTM

Upcoming RPG

Post by goldengamesTM » August 22nd, 2017, 3:21 pm

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.
Attachments
RPG_Crap.zip
(201.71 KiB) Downloaded 138 times
Yes, This Happened.PNG
(18.9 KiB) Not downloaded yet
Last edited by goldengamesTM on August 22nd, 2017, 3:51 pm, edited 2 times in total.

goldengamesTM

Re: Upcoming RPG

Post by goldengamesTM » August 22nd, 2017, 3:38 pm

I'm an idiot and forgot to add the file the correct file the first time.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Upcoming RPG

Post by albinopapa » August 23rd, 2017, 12:57 am

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);
               }
          }
     }
}
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Upcoming RPG

Post by chili » August 23rd, 2017, 1:26 am

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.
Chili

goldengamesTM

Re: Upcoming RPG

Post by goldengamesTM » August 23rd, 2017, 3:39 am

chili wrote:and I13 will be about drawing text. Should all be useful for you project.
You project?

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Upcoming RPG

Post by albinopapa » August 23rd, 2017, 4:46 am

^^Trollin' Chili?
lol
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

goldengamesTM

Re: Upcoming RPG

Post by goldengamesTM » August 23rd, 2017, 2:55 pm

Yep... 8-)

goldengamesTM

Re: Upcoming RPG

Post by goldengamesTM » August 23rd, 2017, 3:13 pm

Thanks Albinopapa! I had to do some tweaking to your code to get it to work, but hey man, it works!

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Upcoming RPG

Post by albinopapa » August 23rd, 2017, 7:00 pm

Good deal.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

OrbitalReign
Posts: 19
Joined: July 17th, 2017, 1:24 pm

Re: Upcoming RPG

Post by OrbitalReign » August 26th, 2017, 7:28 am

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.

Post Reply