Making Video Games

Game Programming Tutorial – RPG click and drag chapter 2 part 1.

by Charles on Sep.25, 2009, under Game Programming

 

This is the second chapter of the RPG game programming tutorials (click and drag inventory and action). Get the GM source code: right-click, save target as. If you just got here you should start there!

 

We’re going to go one step further into elaborating dynamic inventory management. So far, we were able to open a bag using an inventory icon and drag that bag around the room. Now that bag will include items you’ve found playing the game.

 

Of course this requires that it be possible to find items in the game, so that part is covered as well.

 

Part I: What is new – taking game programming into new perspectives.

 

Just like the first time, let’s start by running the game. Put the source code source file in the same folder you put the first one, then double click on it to run it with GM. Run the game by clicking Run the game.

 

rungame

 

It starts just the same as it did before, but now when you click on space when you are near the table there is a reaction.

 

 player options

 

At this point, we are using GM’s built-in dialog boxes. We can make our own from scratch, or customize those somewhat. That will come in later tutorials. For now, we are programming game interaction using those.

 

This game interaction will lead to finding items that will automatically be added in the player’s inventory. In this case we find cookies and a watergun (hey, this is rated PG!)

 

Run through the options and when you’ve found the cookies and the gun, check your inventory.

 

You do this by clicking the bag icon on the right. This is what you see:

 

 Inventory

 

Click on the black top bar and hold the left mouse button down.  Move the mouse around and you see the panel, as well as the newly included objects, move accordingly. 

 

Click on the head or bag button again and the corresponding  panel disappears.

 

We are one step further into interactive inventory management. Let’s look in the game programming code and see how we got it to work.

 

 Back to Game Programming.

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

:, ,

Leave a Reply

Creative Lab

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

    Archives

    All entries, chronologically...