Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / picking up and using objects

Author
Message
Tattered brush
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location:
Posted: 7th Dec 2008 16:16
Hi guys

I am thinking of making a 2d adventure game where the character will be able to pick up items in the game world and use them to solve puzzles. How would I code this?
Once the items have been picked up I want them to be stored in an inventory until they are used.
Any help would be greatly appreciated.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 7th Dec 2008 19:04 Edited at: 9th Dec 2008 02:04
Assuming you'll be using sprites for the player and the item, to check if the player is contacting an item and make them pick it up, you can just use the command SPRITE COLLISION, using the player sprite and the item sprite as the parameters.

If there aren't going to be many items, you can just use a variable for each item.

For example, if there were two items:



Then, when the player tries to complete one of the puzzles, you make sure he has the item needed first, with:



And take it away when he or she finishes the puzzle by setting Item1 back to 0.

If you don't get this, check out this tutorial:
http://forum.thegamecreators.com/?m=forum_view&t=116567&b=7

Actually, check out the tutorial anyway. It'll help .

Tattered brush
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location:
Posted: 8th Dec 2008 13:55
Thats pointed me in the right direction, thanks for your help

Login to post a reply

Server time is: 2024-09-27 22:32:54
Your offset time is: 2024-09-27 22:32:54