Runescape/WoW-Ish RPG AS Help/Debugging

Ok, from the looks of it, you do have a good ground in AS to build upon. And i am really glad, you want to learn!! I am a bit busy these days with some client projects, but i will try to help you as much as i can. Just remember, post your problems precisely, and try to show us what you have tried to solve it…

Now, both Wow and Runescape are MMORPG, are you trying to make a MMORPG or just a RPG? In any case, complete all the tutorials on tonypa’s site about tile based games. You will find it real handy for games like this, and it covers lots of nice functions that you will need to make this more professional. If you need to know anything in particular just ask here. And when you do ask something new, always update the first post with your question, so that everybody can find it easily and help you more… Good Luck!!!

I recommend switching to AS3. Search on these forums for concepts like bitmap rendering and others. It will probably seem really odd to start out with because you’ll stop using movie clips, but the speed is worth it especially if you choose to do larger games.


Also if you choose to use Flex. The Flex 3 SDK came out so download that when setting up the IDE.

since your 13 I’m not sure if your math is high enough for any complex hit detection. If your older brother knows vector math and wants to help you then you can learn to use the Separating Axis Theorem from this tutorial:
http://gpwiki.org/index.php/VB:Tutorials:Building_A_Physics_Engine:Basic_Intersection_Detection
Then look into collision response to find the minimum translation vector to push two object away from one another. Right now you are getting the spazzy collision response because you aren’t moving the object to a place where it won’t collide. So when you move the player right after that find the minimum translation that would move the object out of the other object and move it. To figure this out on paper draw two rectangles. Make one of them your character and the other a wall and find the distance and what direction it would need to not collide anymore. It’s a fun logic puzzle for people normally.

For bluemagica:

I’m not ready for a online multiplayer yet, just think of this game as the simple non multi version of Runescape/Wow. Also, can you give me a link to tonyapa’s site? Thanks alot.

PS: I’m just doing Flash for fun, don’t really have the time to make it very pro-ish. I just want to improve my AS skills with this game.

For Sirisian:

Is As3 very complicated? And is there really a very big difference between As2 and As3? I only have Flash 8 Professional so I can’t do AS3 projects. But if its really great, I could get FlashCS3. And about the collision detections, I know its really crappy since I just put a invisible bar for hitTests and the code is just to pusht the Player away. I’m not great in Physics or Trig. Maybe I should first get a basic game layout done before moving to the details?

Thanks for all your help guys. I’ll keep this topic updated as much as possible.

-Jephz

You don’t have to use Flash CS3 to use AS3. You can just download an IDE like FlashDevelop and use it. If you click the link you’ll understand. AS3 is different than AS2 since it’s completely object oriented. I was using C++ when I was 13, so it’s probably a good idea you start to learn some of these ideas especially if you start using other languages like C# or Java.

Ah ok then. But I’m using a Macinstosh G5 with Tiger. Can FlashDevelop work on Mac? And can you explain to me what is a IDE? Thanks.

Nope. FlashDevelop as far as I’ve ever known only works on windows.

IDE

I guess that a problem. I’d say boot into windows if you have it and try it out as it might be easier to develop using FlashDevelop.I definitely recommend it.

Ok, so lets say I get CS3. I know absolutely ZERO knowledge about AS3. And how will I change my current .fla file to a AS3 Document? Do I have to start over on a new AS3 Document or can I just change the file type from AS2 to AS3? Also, can you give me some good links for basic AS3 tutorials? Thanks.

You will find this exceptionally helpful for moving onto AS3…

[quote=bluemagica;2324976]You will find this exceptionally helpful for moving onto AS3…

Thanks, I’ll be sure to check it out. Now, does anyway have a answer/tips to my current inventory problem?

You started alright with your inventory, but then you are going a bit off-track with the duplicating bit. There are many ways of doing an inventory, but i will tell you a simple way. First Make a tweened background for your inventory, like you have done…Now, go inside this , say invBack_mc. And move it in such a way that the origin point of the invBack_mc lies exactly on the top left corner position, from where you want to start placing the slots. Now comes the fun/trick portion. Make a new mc say 32x32 or so, and call it invSlot_mc , and on the first frame draw a empty square to act as the slot on where to place the items.And then on each successive frame put the pictures of your inventory items, sword, potion, whatever. i hope you have got the idea by now, anyway…

Next just think up how many slots you want in your inventory, 3 columns and 4 rows…


var slot=new Array();
var pos_x=this._x;
var pos_y=this._y;
var gap=5;
for(var i=0;i<4;i++)
{
   for(var j=0;j<4;j++)
   {
      slot[i+j]=this.attachMovie("invSlot_mc","slot_"+(i+j),this.getNextHighestDepth());
      slot[i+j]._x=pos_x
      slot[i+j]._y=pos_y
      slot[i+j].gotoAndStop(1);
      slot[i+j].state="free";
      pos_x+=pos_x+gap;
   }
 pos_y+=pos_y+gap;
}

Now when you make the item mc’s, give them a “item_id” equal to the slot frame number. so on collision


for(var i=0;i<slot.length;i++)
{
 if(_root.invBack_mc.slot*.state=="free")
 {
  _root.invBack_mc.slot*.gotoAndStop(item_id);
  _root.invBack_mc.slot*.state=="item_id";
 } //remember to remove the mc though;
}

This is a very simple way of doing it, if you want to attach actual mc, then just use attachMovie() instead of simple frames.

There are loads of other ways, and most times each coder has his own ways…try to find a way for yourself too :wink:

[quote=bluemagica;2325409]You started alright with your inventory, but then you are going a bit off-track with the duplicating bit. There are many ways of doing an inventory, but i will tell you a simple way. First Make a tweened background for your inventory, like you have done…Now, go inside this , say invBack_mc. And move it in such a way that the origin point of the invBack_mc lies exactly on the top left corner position, from where you want to start placing the slots. Now comes the fun/trick portion. Make a new mc say 32x32 or so, and call it invSlot_mc , and on the first frame draw a empty square to act as the slot on where to place the items.And then on each successive frame put the pictures of your inventory items, sword, potion, whatever. i hope you have got the idea by now, anyway…

Next just think up how many slots you want in your inventory, 3 columns and 4 rows…


var slot=new Array();
var pos_x=this._x;
var pos_y=this._y;
var gap=5;
for(var i=0;i<4;i++)
{
   for(var j=0;j<4;j++)
   {
      slot[i+j]=this.attachMovie("invSlot_mc","slot_"+(i+j),this.getNextHighestDepth());
      slot[i+j]._x=pos_x
      slot[i+j]._y=pos_y
      slot[i+j].gotoAndStop(1);
      slot[i+j].state="free";
      pos_x+=pos_x+gap;
   }
 pos_y+=pos_y+gap;
}

Now when you make the item mc’s, give them a “item_id” equal to the slot frame number. so on collision


for(var i=0;i<slot.length;i++)
{
 if(_root.invBack_mc.slot*.state=="free")
 {
  _root.invBack_mc.slot*.gotoAndStop(item_id);
  _root.invBack_mc.slot*.state=="item_id";
 } //remember to remove the mc though;
}

This is a very simple way of doing it, if you want to attach actual mc, then just use attachMovie() instead of simple frames.

There are loads of other ways, and most times each coder has his own ways…try to find a way for yourself too ;)[/quote]

Thanks a whole bunch ^^ I figured out a way to dynamically do the sliding animation so thats one thing I don’t have to worry about. Now, for the inventory. I dont really want to make a empty frame for each item, since theres going to be a hell lot of items in this game. I just want to create a database with all the items/item id in it(something like a array), then just duplicate a copy from that database whenever a player needs a item. Or I could just assign each item with a id, and create a database full with items idea, then attach a item from the library according to the ID. Is there anyway to do that?

PS: This is my current code for my inventory, although I have no idea how it works and for some reason, it only works if the slots are not in another symbol.

On The Frame:

function addToslot (item) {
if (!item.found) {
item._x = eval (“itemSlot” + currentslotnum)._x;
item._y = eval (“itemSlot” + currentslotnum)._y;
item.found = true;
currentslotnum++;
}
}

On The Items:

onClipEvent (enterFrame) {
if (_root.player.hitTest (this)) {
_root.addToslot (this);

}

}

-_- you didnt understand what i said, did you? I am not telling to make a empty frame for each item, rather i am telling you to put the images of all items under one mc.

Still don’t get what you mean -_- I know I really suck at ActionScript but I just don’t get your code and what you’re trying to explain.

He means create one movieclip which will be a ‘slot’ picture - in each successive frame draw each item as if it was taking up that slot -

So if you had a potion a sword and a key your movieclip would contain:

Frame 0: Empty slot
Frame 1: Slot with potion in
Frame 2: Slot with sword in
Frame 3: Slot with key in

Then you would make sure that the potion had a database ID of 1, the sword an ID of 2 and the key an ID of 3.

It would work and it’s a good idea. Of course I might change a few things, like making a slot item it’s own class and maybe using a case statement to select the frame of each item based on a string rather than an ID then making the name of each item unique in the database - just in case item IDs change.

Ok, so tell me if I’m getting this right.


So how you assign a item with a database ID?

Also, I have no idea about whats a case statement, a class, etc.

ah i know what case statements are now ^^. But how does that relate to my inventory problem? I’m confused again.

-_- Charleh, you are right about the class and string, but jephz is too new, and he needs to know more of the basics first before going to those concepts like class. As for using id instead of string, it will make lesser code at the moment, cause say sword has a id=3, then we know the swords image must be on frame 3; hence we can skip the switch case and such statements at the time…I believe in taking one step at a time, and thats why i showed it in that way.

and Jephz, i see you got cs3, so you will have to learn more of OOP now…anyway, if you still dont understand what i was trying to tell you, then you should hold on for 2 days, and i will make you an example by then!!

[quote=bluemagica;2325921]-_- Charleh, you are right about the class and string, but jephz is too new, and he needs to know more of the basics first before going to those concepts like class. As for using id instead of string, it will make lesser code at the moment, cause say sword has a id=3, then we know the swords image must be on frame 3; hence we can skip the switch case and such statements at the time…I believe in taking one step at a time, and thats why i showed it in that way.

and Jephz, i see you got cs3, so you will have to learn more of OOP now…anyway, if you still dont understand what i was trying to tell you, then you should hold on for 2 days, and i will make you an example by then!![/quote]

thanks a lot blue, same to you Charleh ^^. Oh, and I didn’t get CS3 its just the 30-Day trial. Flash cost a hell lot of $$$ which I don’t have. I’m currently working on some item graphics in Photoshop. They are coming along great. I’ll post a new version of the game with updated graphics in no time.

Ah dogpoop, never had to bump this topic before but here it goes:

BUMP

PS: I updated a new problem.

Excellent… please keep going with this.

What I really want to ask is, are you American McGee’s son? Ps. If so how is grim going?