Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

game user interface

Status
Not open for further replies.

gedion4000

Technical User
Aug 8, 2006
1
0
0
US
hey people whats going on. im creating a live action Myst like game and i was wondering if anyone might help me with some scripting. i want to creat an item list for user interface. basically, if i have an item laying on the ground, and the user right clicks on it, i want it to go into a list to be used later. any ideas on how to do this? im not very bright with scripting so the stupider you can explane it to me the better.

also, say the user comes to a locked door, but picked up the key before in the game. how can i make it so the key opens the door? any help would be AWESOME.

thanks.
S C
 
You probably won't be able to use the right click, but you can use the left click. You could use anything from

If the person is at x,y location and hasKey()

to drag the key onto the door...

how "just like Myst" is it going to be? you going to Spokane to take screen caps too... :)

SWM Programmer Seeking 3d Modeling work. Either for long term commitment or just friendship. Likes long hours in front of a flat screen with heavy doses of Mountain Dew.
 
You could make a context menu... When you right click the movie clip called item a menu with the options that you want will apear... I made a option called Get Item... If you choose it the item movie clip isn't visible on the stage and an instance of the movie clip called dropItem apears... The itemMoved movie clip is in a movie clip called itemL that has the graphic of the list... When you right click it a menu with the option Drop Item apears...

The set up:
Make a movie clip with your item and give it the name item...
Make a movie clip with a graphic that looks like a list... Give it the instance name itemL... Make an instance of the item movie clip and put it in the itemL movie clip where you want it to apear in the list when a user clicks Get Item... Give it the instance name itemMoved...
Put this code on the main timeline on frame 1 or where are the item and the list:

Code:
var itemsMenu = new ContextMenu();
itemsMenu.hideBuiltInItems();
var getItems = new ContextMenuItem("Get item", itemsGet);
itemsMenu.customItems.push(getItems);
itemsMenu.onSelect = menuHandler;
item.menu = itemsMenu;
function itemsGet(){
  item._visible = false;
  itemL.itemMoved._visible = true;
}
                                                                      
itemL._visible = false;
itemL.itemMoved._visible = false;

itemBtn.onRelease = function() {
	if (itemL._visible == false) {
		itemL._visible = true;
	} else {
		itemL._visible = false;
	}
}
stop();

Put this code in the first frame of the itemL movie clip:
Code:
var itemsMenu = new ContextMenu();
itemsMenu.hideBuiltInItems();
var dropItems = new ContextMenuItem("Drop item", itemsDrop);
itemsMenu.customItems.push(dropItems);
itemsMenu.onSelect = menuHandler;
itemMoved.menu = itemsMenu;
function itemsDrop(){
  _parent.item._visible = true;
 itemMoved._visible = false;
}

If you are interested making what I told you, but you didn't understand how to do that, I could give you the .fla file...
 
I forgot to tell you about the button that oppens the list with the items... Make a button and give it the instance name itemBtn...
When you press it the list apears... If you pressed Get Item in the menu the Item will apear in the list and you could press Drop Item...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top