Be a Supporter!

AS: Inventory 1

  • 5,292 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 2005-07-02 17:04:07 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 2005-07-02 17:40:23 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 2005-07-02 18:02:06 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 2005-07-02 18:10:48 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 2005-07-02 18:11:44 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 2005-10-17 11:06:11 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 2005-10-17 13:52:28 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 2005-10-17 14:07:54 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 2005-10-17 15:26:48 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 2005-10-17 15:49:12 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 2005-10-17 16:13:54 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 2005-10-17 16:26:53 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 2006-04-29 11:58:53 Reply

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


Song of the Firefly is on Steam Greenlight and Kickstarter. Give them a look and support the project!
------------------------------

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

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


Song of the Firefly is on Steam Greenlight and Kickstarter. Give them a look and support the project!
------------------------------

BBS Signature
Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to AS: Inventory 1 2006-04-29 12:09:18 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 ;)


Song of the Firefly is on Steam Greenlight and Kickstarter. Give them a look and support the project!
------------------------------

BBS Signature
mazuibentou
mazuibentou
  • Member since: Nov. 10, 2004
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to AS: Inventory 1 2006-05-18 03:05:05 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 2006-06-22 18:28:35 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 2006-07-09 14:57:20 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 2006-07-29 13:18:06 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 2006-07-29 13:27:24 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 2006-12-11 19:43:48 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 2007-04-23 12:59:37 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 2007-04-23 13:06:52 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 2007-04-23 14:13:30 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 2007-08-27 15:27:25 Reply

I don't understand this at all