A retro-inspired 2D Action RPG set in the distant future (DEMO)4.55 / 5.00 35,000 Views
Travel the world on an epic shark lifting adventure!4.18 / 5.00 16,874 Views
What happens after the final boss is defeated?4.04 / 5.00 11,025 Views
At 2/24/13 10:03 PM, Diki wrote:At 2/24/13 08:35 PM, cheese123 wrote: The for loop seemed unnecessary ... I just needed the while loopYou know that the only significant difference between a while loop and a for loop is syntax, right?
They're both loops and can break your application if used incorrectly.
If you don't understand the difference between the assignment operator and the equality operator then you can't know them well enough to be able to use them to do what you want. They are very different operators and cannot be used interchangeably.
thanks for all the info! and yea normally if something like 'if(x=y)' wouldn't work, i would just resort to 'if(x==y)' not really knowing the difference. yea you guys might cringe at that :P
At 2/24/13 09:57 PM, MintPaw wrote:At 2/24/13 08:23 PM, Rustygames wrote: Don't use a language over 6 years old. Really? I hope you realize how silly a comment that was :)Meh, I probably could of rephrased that "Don't use a language that was last relevant over 6 years ago."
The only reason you'd use AS2 at this point is you're too lazy to get up-to-date, it costs nothing but time and effort, I've almost completely resolved to not take the time to help people who won't take the time to help themselves.
Sorry I guess I was being a bit of a pedant :)
People not wanting to take up time and effort to learn I can understand (although it really doesn't take a lot to move from one to the other!), but then coming and asking for help and not willing to take it on board if it requires any effort does my head in as well!
At 2/25/13 04:05 AM, Filipus wrote: Ok i PM you cheese.
I already said i will move to AS3 after this. But i want to finish this AS2 project now. Its an inventory guys, it should't be that much work. You are all making a big fuss out of it. "AS2 is outdated, i wont help because you'r stupid if you use it!".
Sorry we went off topic and didn't help, unfortunately I don't think any one who replied is willing to help you learn how to code unless it's in AS3
- Matt, Rustyarcade.com
Well, cheese helped me and i already have a working inventory. I'll post the results tomorrow (the fla file) to help the little nobbies like me :)
I don't even program in as2 or as3 or as1902381023948209348
I googled some stuff about it.
as2 doesn't have an arraylist class.
Why are you programming in as2 again?
I'm not sure if S@ has it, but with AS3 you can use flash's Listing component for inventory.
I noticed your frustration of trying to get a inventory system working in AS2
I highly recommend you move to as3 but for now I will tell you how a inventory system works in as2. Before you start coding you need to know how the code gets executed and what happens first, how fast it gets executed.
I will tell you the easiest way to do this, You can start by making a Movie Clip. This Movie clip will be your inventory slot
The first frame of the movieclip will be a empty slot, The second frame will be a slot with a item in example (HP potion), The third frame will be a slot with another item in, For example a mana potion.
You then need to make an array, With empty strings in for how many inventory slots you got
var invarray:Array = new Array("Empty", "Empty", "Empty");
Lets say we have 3 inventory slots
An Array will hold multiple values, In this case we are going to pass our items as strings.
Then after the array is made you need to make a function which will add items to the array
So lets start
var addonce:Boolean = false;
if(invarray[a] == "Empty")
invarray[a] = item;
addonce = true;
The add once variable stops the for statement finding all slots that are empty and just finds the first one
After this we need to display the items in the inventory
As you can see we call this function from the AddItemsToMyArray function
if(invarray[i] == "ManaPotion")
if(invarray[i] == "HPPotion")
As you can see we have declared something called invSlotsArray, This will hold your inventory slots.
Now go back to the top and make it
var invSlotsArray:Array = new Array(_root.invs1, _root.invs2, _root.invs2)
This will hold your inventory slots, Now go back to your scene and copy the inventory slot we made earlier, Now there are 3, Give them a instance name of invs1, invs2 and invs3.
If anything was wrong or you don't understand, I made these tutorials a few years back