Page 1 of 1

Help with Inventory

PostPosted: Tue Oct 04, 2005 10:55 pm
by ALK3_Steph
Hello all! Ok new problem involving view. I want to make an inventory screen (Im not worried about coding for picking things up, using them, etc, just how to change the view)

So far, the player is parent to the view, so ti follows him in a fixed position. I want to hit the ' I ' key, and it switch to a screen that will show various things. So I tried to make a key down event for ' I ' and change the parent of view, to inventory, but it didnt work. Is there a special way I need to do this?

PostPosted: Tue Oct 04, 2005 11:52 pm
by Joshua Worth
Try somthing like this on your key down event:
Code: Select all
if (inventory_on==1){inventory_on=0;)
if (inventory_on==0){inventory_on=1;)
if (inventory_on==1) {
  ChangeParent("view", "inventoryscreen");
  view.x=inventoryscreen.x;
  view.y=inventoryscreen.y;
                     }
                     
if (inventory_on==0) {
  ChangeParent("view", "player");
  view.x=player.x;
  view.y=player.y;
                     }

PostPosted: Sun Oct 09, 2005 5:07 am
by Joshua Worth
Did you try it, did it work?

PostPosted: Mon Oct 10, 2005 2:01 pm
by ALK3_Steph
OH! Sorry I didnt reply. I havent tried it yet, because my trial ran out and I gotta wait til Friday (payday, woo!) then I get it and give it another try. I WILL keep you posted on this one

PostPosted: Tue Oct 11, 2005 5:57 am
by Joshua Worth
OK

PostPosted: Tue Oct 11, 2005 7:46 pm
by ondy1985
Joshua Worth wrote:Try somthing like this on your key down event:
Code: Select all
if (inventory_on==1){inventory_on=0;)
if (inventory_on==0){inventory_on=1;)
if (inventory_on==1) {
  ChangeParent("view", "inventoryscreen");
  view.x=inventoryscreen.x;
  view.y=inventoryscreen.y;
                     }
                     
if (inventory_on==0) {
  ChangeParent("view", "player");
  view.x=player.x;
  view.y=player.y;
                     }

Imho this WILL NOT work. Not correctly. The last "inventory_on==0" branch will never be executed.

PostPosted: Wed Oct 12, 2005 12:33 am
by ALK3_Steph
Oh, why not? I dont fully understand the code or the whole statement so, could you explain more why it wont?

PostPosted: Wed Oct 12, 2005 3:31 am
by Joshua Worth
Right :oops: I didn't think of that. You might have to set another variable to skip the second line :roll:

PostPosted: Sat Oct 15, 2005 2:43 am
by ALK3_Steph
Woo Im official. Haha