Be a Supporter!

AS: Inventory 1

  • 5,241 Views
  • 24 Replies
New Topic Respond to this Topic
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
AS: Inventory 1 Jul. 2nd, 2005 @ 05:04 PM Reply

AS: Main

This covers very very basic inventory creation, no knowledge of arrays needed ;)
My next inventory tutorial (Inventory 2) will cover better inventory creation.

This will allow you to create:

A simple 1-about 20 object inventory.

So let's begin:
All objects (that are pickable) on the screen need to have an ID (identifier number to differ them from other objects), and the following code

on(release){
_root.inventory[_root.available].gotoAndStop(<id code here>);
_root.available++;
}

remmember to have _root.available=1 on the first frame actions;

each ID will have it's frame on the inventory symbol, the inventory symbol itself is a square movieclip. remmember to name each inventory symbol inventory1 inventory2... inventoryN

now on _root you need to select available, paste this code, the onEnterFrame part runs every frame, if you don't want to mess with this code, you can just create 8 different inventory symbols, each with a different "object" to fit, and each will have gotoAndStop(2); when the object is present and gotoAndStop(1); if it's now.

every time you click an item (add it) you

btw, to remove an item you move every item in the following inventory ID's (1... N) one MC back, and change a var or something.

So how do I check for the objects?
run a simple loop on the inventory symbols or keep a variable ;)

ask any questions, wasn't very detailed, so feel free.

Toast
Toast
  • Member since: Apr. 2, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Inventory 1 Jul. 2nd, 2005 @ 05:40 PM Reply

Not bad,pretty basic.


BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: Inventory 1 Jul. 2nd, 2005 @ 06:02 PM Reply

of course it's basic, I have 6/8 advanced tutorials but only 1 basic one :P

Nemo
Nemo
  • Member since: Jun. 13, 2003
  • Offline.
Forum Stats
Member
Level 34
Game Developer
Response to AS: Inventory 1 Jul. 2nd, 2005 @ 06:10 PM Reply

You're really getting into this AS:____ stuff? I need to think of a good tutorial to make, while I'm on the subject :-)


BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: Inventory 1 Jul. 2nd, 2005 @ 06:11 PM Reply

I kinda wanted to make a basic tutorial since most of my stuff is advanced and probebly won't reach that much people ;)

yea, I'm getting into AS: _____ stuff :P

IWantSomeCookies
IWantSomeCookies
  • Member since: Aug. 20, 2004
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to AS: Inventory 1 Oct. 17th, 2005 @ 11:06 AM Reply

Wow, this could come into handy when making future games. The AS: collection is so handy.


"Actually, the server timed out trying to remove all your posts..."
-TomFulp

Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to AS: Inventory 1 Oct. 17th, 2005 @ 01:52 PM Reply

At 10/17/05 11:06 AM, IWantSomeCookies wrote: Wow, this could come into handy when making future games. The AS: collection is so handy.

Wow Observation of the year award


- Matt, Rustyarcade.com

oscar-the-duck
oscar-the-duck
  • Member since: Jul. 24, 2005
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to AS: Inventory 1 Oct. 17th, 2005 @ 02:07 PM Reply

At 10/17/05 01:52 PM, Ninja-Chicken wrote:
At 10/17/05 11:06 AM, IWantSomeCookies wrote: Wow, this could come into handy when making future games. The AS: collection is so handy.
Wow Observation of the year award

You're not funny loser.

fwe
fwe
  • Member since: Jul. 24, 2003
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: Inventory 1 Oct. 17th, 2005 @ 03:26 PM Reply

You didn't define the inventory array, meaning it wouldn't work


wtfbbqhax

Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to AS: Inventory 1 Oct. 17th, 2005 @ 03:49 PM Reply

At 10/17/05 02:07 PM, oscar_the_duck wrote:
At 10/17/05 01:52 PM, Ninja-Chicken wrote:
At 10/17/05 11:06 AM, IWantSomeCookies wrote: Wow, this could come into handy when making future games. The AS: collection is so handy.
Wow Observation of the year award
You're not funny loser.

ha ha welcome to newgrounds prick oops sorry youve been here a while so you should know the rules including
NO ALTS

faggot

- Matt, Rustyarcade.com

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: Inventory 1 Oct. 17th, 2005 @ 04:13 PM Reply

At 10/17/05 03:49 PM, Ninja-Chicken wrote: ha ha welcome to newgrounds prick oops sorry youve been here a while so you should know the rules including
NO ALTS
faggot

actually that account was created by puzz over a year ago, the password is pretty well known, it could be just about anyone

Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to AS: Inventory 1 Oct. 17th, 2005 @ 04:26 PM Reply

At 10/17/05 04:13 PM, Inglor wrote:
At 10/17/05 03:49 PM, Ninja-Chicken wrote: ha ha welcome to newgrounds prick oops sorry youve been here a while so you should know the rules including
NO ALTS
faggot
actually that account was created by puzz over a year ago, the password is pretty well known, it could be just about anyone

Really
Why is there only 2 posts then?
Oh well whoever it was is a fag and is obviously too scared to show who they really are


- Matt, Rustyarcade.com

Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to AS: Inventory 1 Apr. 29th, 2006 @ 11:58 AM Reply

i dont get it... its not explained very well for someone who hasn't the faintest idea what the hell your talking about...


Decima: The Last Story of Vald has a Facebook page and a development blog. Give them a look!
------------------------------

BBS Signature
Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to AS: Inventory 1 Apr. 29th, 2006 @ 12:04 PM Reply

i understand it now, but it doesn't work... i am using flash mx 2004, i dunno if that will change it...


Decima: The Last Story of Vald has a Facebook page and a development blog. Give them a look!
------------------------------

BBS Signature
Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to AS: Inventory 1 Apr. 29th, 2006 @ 12:09 PM Reply

fixed it, if your using flash mx, this will replace the code on the item:
on(release){
_root["inventory"+_root.available].gotoAnd
Stop(<id code here>);
_root.available++;
}
hope that helps ;)


Decima: The Last Story of Vald has a Facebook page and a development blog. Give them a look!
------------------------------

BBS Signature
mazuibentou
mazuibentou
  • Member since: Nov. 10, 2004
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to AS: Inventory 1 May. 18th, 2006 @ 03:05 AM Reply

the briefness of this confuses me. so you make an MC with an instance name of inventory
on the first frame in this MC add _root.available=1

make a button with no instance name. add this code to the button:

on(release){
_root.inventory[_root.available].gotoAndSt
op(1);
_root.available++;
}

and then if you click the button it adds it to the inventory? not working for me... and im sure yall are gonna say nooooo you noob. well yes im a definate noob

Plumb
Plumb
  • Member since: May. 6, 2006
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: Inventory 1 Jun. 22nd, 2006 @ 06:28 PM Reply

Love it, great tut man :D, will definetly use it.

catman03
catman03
  • Member since: Jul. 5, 2006
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to AS: Inventory 1 Jul. 9th, 2006 @ 02:57 PM Reply

none of this has worked!(im using flash 8)ive tried everywhere and nobody has any help!nothing works!i am such a noob and i know it but just please help!


We are the resistance, we are the underground, we are Newgrounds: home of the original cock joke.
The world takes everything too seriously.
This is not a signature.

mothballs
mothballs
  • Member since: Nov. 16, 2005
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to AS: Inventory 1 Jul. 29th, 2006 @ 01:18 PM Reply

You should have made this in a flash tutorial.

UKZ
UKZ
  • Member since: Apr. 11, 2006
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to AS: Inventory 1 Jul. 29th, 2006 @ 01:27 PM Reply

ok see i have an inventory with five slots each instance names inventory1 inventory 2 and so on and so forth. i need the AS for when i click an object the object goes into the inventory slots.


Crews:
Graffiti Crew
Stoner's Club

BBS Signature
sniffy-gerbil
sniffy-gerbil
  • Member since: Apr. 14, 2006
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: Inventory 1 Dec. 11th, 2006 @ 07:43 PM Reply

It's basic, a little too basic.
I think you need to explain a little more.
If it fits into the basic section, you need to explain a lot because it's for beginners.

Good code in the end though. :)

AshSamael
AshSamael
  • Member since: Jan. 19, 2004
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to AS: Inventory 1 Apr. 23rd, 2007 @ 12:59 PM Reply

Hey Inglor, your tutorial rocks, but I couldn't get one thing: how does the item add itself to the second slot if the first one is occupied?


HEADSHOT!

BBS Signature
jobizzie
jobizzie
  • Member since: Aug. 21, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to AS: Inventory 1 Apr. 23rd, 2007 @ 01:06 PM Reply

Is the ID code the instance name?
Good tutorial though. :)

Jereminion
Jereminion
  • Member since: Nov. 6, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Inventory 1 Apr. 23rd, 2007 @ 02:13 PM Reply

can you post an example swf to see if this is what i want(or what other people wnat)

WasabiClock
WasabiClock
  • Member since: Aug. 17, 2007
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to AS: Inventory 1 Aug. 27th, 2007 @ 03:27 PM Reply

I don't understand this at all