ForumsProgramming ForumEscape game AS. Need help with inventory.

17 7279
Kynia
offline
Kynia
10 posts
Nomad

Hey. I'm Kynia and I've been looking for some help with a problem I've come across in a game I'm making. Which you can click on the link here.

http://www.newgrounds.com/dump/item/f614d8af5be6146870b41dae50316cab

Basically, the problem is that when you click on an item and it appears in your inventory. Now when you leave to go to the other side of the room (the next frame) and then come back the (previous frame) items reset themselves. I'm looking for the simplest way to do this. Of course in that clip, I had newbishly was just using go to so and so frame in the movie clip to appear the item was gone.

I made this separate file to test out a code to see if I could get past this problem, so I could apply it to my game.

http://www.newgrounds.com/dump/item/757e04f0d08be34d0905759168fbb4c2 -Swf file

http://www.newgrounds.com/dump/item/53d6cd5b128cda3d6b7ef049f0615a6a -fla file

Though same problem though the coding I was using on a separate layer for the first frame is this.

stop();
pil._visible=false;
pil2.onpress=function(){
pil._visible=true;
pil2._visible=false;
}

  • 17 Replies
Kynia
offline
Kynia
10 posts
Nomad

Oh, also I'm working with Flash MX 2004 just so you know (Ah, yes kinda old, though least it wasn't a much older version I had.)

Darkroot
offline
Darkroot
2,763 posts
Peasant

You could create a check that checks if pill is in the inventory to not make it visible.

stop();
if (pill in inventory)
pil._visible=false;
pil2.onpress=function(){
pil._visible=true;
pil2._visible=false;
}

Kynia
offline
Kynia
10 posts
Nomad

It's my first time making a game like this and any step by step tutorial I've read hasn't really explained how to make the item you found stay invisible when going to another frame.

Darkroot
offline
Darkroot
2,763 posts
Peasant

You might want to not put all the code in frames but on a separate layer.

Secretmapper
offline
Secretmapper
1,747 posts
Nomad

You might want to not put all the code in frames but on a separate layer.

Easiest way
Kynia
offline
Kynia
10 posts
Nomad

It is on a separate layer. I usually keep them on a layer named 'actions' away from my movie clips.

Darkroot
offline
Darkroot
2,763 posts
Peasant

Yes but are you coding on the key frames on a separate layer, because it's the same problem.

Kynia
offline
Kynia
10 posts
Nomad

Sorry, then I'm not quite following then, even though I'm on a separate layer it's still not right?

I'm not exaclty an intermediate flash user, unfortunately and looking for an over all simple solution. A lot of tutorials haven't really went into a lot of depth about this out of so many I've read.

rjbman
offline
rjbman
215 posts
Nomad

So you're programming on the main timeline?

Darkroot
offline
Darkroot
2,763 posts
Peasant

No I think hes coding in the frames.

Kynia
offline
Kynia
10 posts
Nomad

I'm programming on the time on an empty frame I separated from the others that's for my actions.

And I'm a girl just to say.

http://www.newgrounds.com/dump/item/c8ece85dfb724a9a74d29ceb000fed24

Tried a different approach, but still over all generic problem.

Darkroot
offline
Darkroot
2,763 posts
Peasant

And I'm a girl just to say.


My bad.

Lets look at your code then.

stop();
var door_btn:Button; <--- What's the point?
door_btn.enabled=false; <--- ??
var swipecardlocated:String;
swipecardlocated="hidden"; <--- Redundant you don't use it anyway
swipecard2_mc._visible=false;
swipecard1_mc.onpress=function(){ <--- No condition?
swipecard2_mc._visible=true;
swipecard1_mc._visible=false;
swipecardlocated="found"; <--- Again Redundant
}


It's pretty painful reading your code. I would recommend you to find someone to do the coding for you. Also the code above functions exactly as this.

[i]stop();
swipecard2_mc._visible=false;
swipecard1_mc.onpress=function(){
swipecard2_mc._visible=true;
swipecard1_mc._visible=false;
}[i]

If I find the time I will re-write your code or someone else will.
There is not much salvageable.
Kynia
offline
Kynia
10 posts
Nomad

No worries. ;3

Is it that bad? Oh, the door_btn is actually for the door on the next frame actually. I mean to erase it, since the door would be false until until "so and so" items are needed to open it then it becomes true.

Is it redundant to use that? It's just for the dynamic text box on the side of the stage that can't be seen.

Well, I have been looking for help though I haven't really found anyone that can. Even on newgroudns, and a lot of people there are jerks and there advice is to basically go look it up.

Kynia
offline
Kynia
10 posts
Nomad

Oh, I can fix that part. Though it's still the same over all general problem I still have.

Darkroot
offline
Darkroot
2,763 posts
Peasant

Yea there was a bunch of useless stuff in there, maybe try rewriting it and removing the waste?


That's not it.

Yeh I'm pretty lazy and busy. I'll fix it after exams.
Showing 1-15 of 17