Making an RPG type game
In this tutorial you will learn how to make a RPG type game in flash. I will only be teaching you how to set up the character and the actionscript, not how to animate the character. You should already know some actionscript and know how to find your way around flash.
The final result will look something like this.
First of all you need to make two movieclips of your main character, the first one is a birds eye view (top, looking down on the character) of him/her standing still. The other one of them walking. Now put them both into one movieclip, with the standing still MC (movieclip) on the first frame and the walking MC on the second frame. Make sure you put the action ’stop();’ without the quotes on each of those frames. Once you have that done give that MC an instance name of ‘man’ and put these actions on it:
if(Key.isDown(65)){
this._rotation = 270;
this._x -= 3;
this.gotoAndStop(2);
}else if(Key.isDown(68)){
this._rotation = 90;
this._x += 3;
this.gotoAndStop(2);
}else if(Key.isDown(87)){
this._y -= 3;
this._rotation = 0;
this.gotoAndStop(2);
}else if(Key.isDown(83)){
this._y += 3;
this._rotation = 180;
this.gotoAndStop(2);
}else{
this.gotoAndStop(1);
}
}
Okay, I will try to explain that as best I can.
onClipEvent(enterFrame){
All that means is ‘every time this frame is entered’. So if you have a frame rate of 30 (which I do) the following script would run 30 times a second.
if(Key.isDown(65)){
this._rotation = 270;
this._x -= 3;
this.gotoAndStop(2);
‘If the key ‘65 is down, this rotates to 270 degrees, this _x decreases by 5 (moves left) and this goes and stops on frame 2 (the walking frame). 65 is the key code for ‘A’. For this tutorial the controls for the character are going to be ‘W’, ‘A’, ‘S’ and ‘D’. Most of the other code is exactly the same as above with a few numbers changed, so I am not going to explain that.
}else{
this.gotoAndStop(1);
If none of the above code is happening (In other words, if none of the keys are down) this MC can go to and stop on frame 1 (the standing frame). Therefore when the MC isn’t moving it will stop on frame 1.
Now, if you haven’t already make an item for you character to pick up, and an inventory for it to go in.
Now, copy and paste your item and place the copied one in the inventory, like so:
But make it’s alpha 0, so you can’t see it. Give it an instance name of ’smallItem’ without the quotes.
Now select your item (the visible one), and put these actions on it:
if(this.hitTest(_root.man)){
this._alpha = 0;
_root.smallItem._alpha = 100;
}
}
All that means is when the ‘man’ MC hits the item (the visible one), that ones alpha goes down to 0 and the one in the inventories alpha goes up to 100. So it looks like you have taken the one of the ground and put it into your inventory.
That is it for this tutorial. Keep coming back for more















Awsome. I love your tutorials, keep em’ comming.
I made this with the help of some of your tutorials.
http://www.deviantart.com/deviation/42079834/
Nice work
Hi,
Are you going to be continueing this tutorial to make like a full game.
Thank
How did you program it to make the W,A,S,D keys move? Whenever I try to incorperate those into a game it doesn’t accept them.
@Lachy: Yes, but it might not be for a while.
@Bob: What version of flash are you using? If you use the code I used there it should work fine.
Flash 8 (basic). I need to be more specific, How do you program letter keys in any flash. Is there a website that will tell you what number is assigned to what letter?
Wait that didn’t make much sense either. I mean to say, what numbers for any key.
I don’t get it, just kidding!
@Bob: http://www.awestyproductions.c.....eycode.txt
Thanks! That will help.
Hi Awesty,
I was just wondering if there was some way of selecting the sword when you have it in your inventory.
@mohit: id say that will be in the next tutorial
when will the next tutorial be out?
thanks for the tutorial
http://denvish.net/ulf/1164564329_RPG Item example.php
that’s hat i made from it
I made few altercations though
1: for movement i used friction etc from the other tut
2: instead of playing with the MC’s alpha, i used blank keyframes, so my code was like
onClipEvent(enterFrame){
if(this.hitTest(_root.knight)) {
this.gotoAndStop(2);
_root.inventory1.gotoAndStop(2);
}
}
great tut, look forward to more by you
How do you make a flash game on your own?Cause I want to make one but I dont know how to…
@iAnimate: Nice, I never thought of that. I might have to try it out.
Btw, I don\’t think denvish works anymore.
@Zach: Just apply all your knowledge from tutorials into your game.
@Mohit: Yea, what eb264 said. There are so many tutorials I am trying to do at the moment I keep forgetting them.
@David: Do you mean one in particular? Because I try to add at least one every week, plus maybe a few articles or something. But I have been a bit slack lately because I have had other stuff to do.
dude you should make like a Ninja game it would kick ass, you know like running up walls and like sticking to them using a Samurai Sword and some sherikans (ninja stars) that would be sick! (Also if you don’t know wut i mean play Matrix Bullettime Fighting [I furgot wut website it was on but u can search it up on google :)])
Just a though
Just a thought*
would your name be kittle by any chance
Do you mean a tutorial about it or actually make it?
actually make it
then we can all play it 
Where do you find good life ,of course in the games .beause in the real life ,we have many distresses and pain, only in the games if we have enough gold to buy the good arms,and we can play the games well
@Bryce: Lol, that would take ages and involve a fair bit of coding. I don’t know if I’m up for it.
@Dorain: …
I understood the tutorial, but I’d like to know how to make the character throw an object, and how I can make an enemy move and throw an object at random and harm the character on contact.
I will do a tutorial on birds eye view AI.
how can i make it change character frames when i turn?
That script already makes it go to the 2nd frame, if you want it to go to different frame just change the number.
this tut is very good but i wanna know more about buying and trading inventory system… anyone has that kind of tut please let me know..? TNX…
Nice tut. it helped alot. I know this isnt topic related but does anyone have a tut on how to make a certain key play a certain noise, cause i want to make a game that allows you to play an instrument but you have to hit certain keys to get points, i hop you know what i am talking about.
Thankyou,
Darker
Awesty i have a “money shop” but im trying to make it when you have $10 (U.S.A. currency) you cant buy a $100 thing but when i click (buy $100 thing) it will say -$90 then it will say you have no money. this is hard to explain so ill send you a .fla file, (but my e-mail isn’t working to well and doesnt recgonize ur e-mail address so e-mail me then ill reply with the .fla file) my e-mail is ekusnierz@san.rr.com
ty
also when i e-mail you the .fla file can you give me some advice to? as when you buy the item it goes into your inventory? (ill have to make an inventory tho :))
can you show me how to make a currency, cause i really want to make a full flash game, if anyone has a different tutorial site please post it. It wouldnt really work to send me an email tutorial because my email doesnt work.
Much Appreciation,
Darker
@Bryce K: I got you email and replied.
@Everyone else: I will try to implement these into future tutorials.
ok i got everything working except this… i want my guy to permanently change frame when he pics up a sword so he goes from regular “man” to “sword man” so to speak…. when i step on the sword it changes the frame but when i step off it changes back….
please help me!!!
Okay, change this:
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
this._alpha = 0;
_root.smallItem._alpha = 100;
}
}
To this:
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
this._alpha = 0;
_root.smallItem._alpha = 100;
_root.man.gotoAndStop(FRAME);
}
}
Just replace FRAME with the frame number of the “sword” man.
well darn it still not working…. do you think i could send it to you and u can try to see whats wrong?
it would be a great help
if so then whats your e-mail?
make sure he has the instance name of man.
awesty i replied the e-mail
@RedV: admin[@]awestyproductions[.]com
@Bryce K: Yep. I might not reply tonight, I will when I have time.
awesty do you have a tut on rpg inventory.. i mean with trading system or buying items.. please let me know where i could have that kind of tut..
TNX A LOT…
okey dokey
@gram669: To tell you the truth I have never seen a tutorial like that. Maybe I might do one.
im sorta new to this flash, is there and easier way to understan this?
Hi. Good tutorial! Ive got one problem - when i load the game the small sword is already in the inventory box, and the big sword is on the ground (but it can still be picked up) cud u plz help?
hey he dosent walk diagnal waaaaaaaaaaaaaa but still nice work
plz make him walk diagnal.
@@”"£barns£”"@: No.
@RDB2006: Click on the small sword and in the properties panel you should see a drop down menu called Color. Click on it and select alpha. Make it 0.
@ebulp: Maybe.
i tried it, nd still doesnt work. WHen i change its alpha to 0 it can still be seen when i preview the game, and it also changes every other movie clip’s alpha to 0, and nothing disapears
:S
Im using all this stuff in ur tuts to put together a wee game, but im stuk, i have 4 drawings of my chacrater, he has his back facing towards you, he is facing you, he is facing left, he is facing right. Do you know how to make it so that when you use the arrow keys, the picture will change? e.g u press the left key and the picture of im facing left comes up, etc?
@RDB2006
name each frame of what the picture is of (eg. left, right, front, back)
and use this code:
onClipEvent(load){
if(Key.isDown(Key.LEFT)){
this.gotoAndPlay(”left”);
}
if(Key.isDown(Key.RIGHT)){
this.gotoAndPlay(”right”);
}
if(Key.isDown(Key.UP)){
this.gotoAndPlay(”back”);
}
if(Key.isDown(Key.DOWN)){
this.gotoAndPlay(”front”);
}
}
the last 2 are based on if when you press the UP arrow key, you want his back facing you (eg. he’s moving away from the screen) and when the DOWN arrow key is pressed, you want him to move towards you and face you. Should work
kk ty eb ill try it soon
Yep, eb246 is right. But I prefer to use frame numbers than labels, but that is just a personal choice.
Also you could use
if(something){
do this
}else if(somethign){
do this
}
So then it doesn’t jerk up when someone pushes two buttons at once.
i made 4 frames with the diff pics, nd i put the code on everyguy. It still doesnt work, but no errors come up :S
An error only comes up if there is a problem with the syntax, not if it doesn’t do you want it to since flash can’t tell what you want it to do.
You only need 1 MC, and put that code on it.
I’m trying to make an RPG and i’ve run into a problem:
How do you link scenes/frames together so that when you hit a door the scene/frame(which ever is easier) will switch to the inside of a room.
I know it has something to do with the hit.test action script code but I can’t figure it out
@Gray - Copy and paste this code into the door.
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
_root.gotoAndStop(41);
}
}
Change 41 to whatever frame number the inside of the building is on. nd make sure the instance name of your char is man.
how do u make it so that when your char hits an object, a picture and text will appear without it changing frame, and when you bring your character off the object, it disapears. Im tryna make a game like the sims…..
and does anybody have a good name for my game? i want a really good name but my mind is completley empty
k so i have only once MC (Guy facing towards u) nd put this code on it
onClipEvent(load){
if(Key.isDown(Key.LEFT)){
this.gotoAndPlay(”left”);
}
if(Key.isDown(Key.RIGHT)){
this.gotoAndPlay(”right”);
}
if(Key.isDown(Key.UP)){
this.gotoAndPlay(”back”);
}
if(Key.isDown(Key.DOWN)){
this.gotoAndPlay(”front”);
}
}
nd i replace down nd stuff with numbers? nd leave the guy facing left, right, and back facing you, non movie clips?? :S
thanks that really helped
@rrr444: You would have to put something like this on it:
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
this._alpha = 100;
}else{
this._alpha = 0;
}
}
Just change man to whatever the MC is called.
@RDB2006: You can replace “LEFT” etc with the numbers of the frames if you like, or you could give the frame facing left the name left, the frame facing right the name right etc.
wouldnt i hav to put code on the text and the person i wana walk into?
can somebody help me?
when the player moves the man, and it hits the door, and then also presses a button, then it leads to another frame?
hi umm i want to make a game can somebody tell me
i know how to walk into an object and get to a different frame but how do you get it so that when you come out of the frame you went into, (say a shop,) it returns you next to the door, not originally where your character started out on that frame. any help????
hey im realy looking foward to the next tutorial
keep em coming when is the next one lined up for
awesty: tnx so much.. im looking forward on it.
@RDB2006
you need to have a movieclip with the four frames inside and a stop(); action on each frame. then on the main scene, click once on the character and put the code in the actions panel. don’t forget to name each frame
thanks for the tut it helped me. Would it work if you sent it by email to your cell phone? I mean would you be able to play it because cell phone games are java but still…
ok. Ive set a specfic text field to alpha 0. When you click a button, i need it to appear. Can you help
how do you put to guys in MC and then switch between them.
I need help with mine, How do you make a wall, I mean so you just make like a rectangle and like instance name it wall or w.e and the hole thing turns into a wall? Instead of just keep naming top one top1 bottom one bottom1 and so on. Also if theres actionscript tell please
can someone tell me wuts worng with my Xp bar its malfunctioning http://www.swfup.com/swf-view.php?id=3345
@rrr444:
on(release){
_root.TEXT._alpha = 100;
}
Just change TEXT to whatever the text MCs instance name is.
@yakult: So you want that to happen?
Once you have the button and the door, put this code on the button:
on(release){
if(_root.man.hitTest(_root.door)){
_root.gotoAndStop(FRAME);
}
}
You would obviously have to change the doors instance name to what it really is and change FRAME to what frame you want it to go to.
About the door thing, you would use a variable, so when it hits the door, door = true. So when it enters the shop if(door = true) it starts off in a certain _x and _y coordinates.
@no1jock: As far as I know, it wouldn’t work.
@ptp: You would need to put them both into 1 movieclip, one on the 1st frame and one on the 2nd. And then to use the first do _root.man.gotoAndStop(1);. Just change the frame number depending on which one it is. Make sure the guy has an instance name of man though.
@John:
http://www.awestyproductions.c.....h-hittests
@Bryce K:
Can you post or send me the code so I can have a look at it?
@mike: Hopefully over the next few days.
okay i e-mailed the code to you, plz post it in the forums cause the e-mail isnt workin rite
There are no errors anymore, but it doesn’t jump. I wasn’t sure what it was supposed to do so I just left it like that.
onClipEvent(load){
if(jumping == true && this.hitTest(_root[”ground” i])){
if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){
if(this.hitTest(_root[”ground” i])){
var jump:Number = 0;
var falling:Boolean = false;
var g:Number = 4;
}
onClipEvent(enterFrame){
if(jumping == false){
if(!falling){
jump = 0;
}
if(Key.isDown(Key.UP)){
jump = 15;
jumping = true
}
}
if(jumping == true){
jump -= 1;
}
if(jump <= -10){
jump = -10;
}
for(i=0;i
//Is there supposed to be some code here?
}
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;
}else if(Key.isDown(Key.RIGHT)){
this._x = 5;
}
for(i=0;i
falling = true;
this._y -= 1;
}
if(falling == true){
for(i=0;i
falling = false;
}
}
jump -= 1;
}
}
}
wasn’t even close to working had to many errors (and i did fix most of them)
I have problem, everythings right, instances, MCs, all that other stuff but one my character touches the pick-upable object it doesn’t do anything. Help?
@Bryce K: That is very weird, it didn’t have any errors for me.
@Eddie: What version of flash are you using?
Awesty this tutorial is really good, but since you use alpha you would have to have a different inventory slot for every item in the game right?
I’m not saying it isn’t still a good idea, but I searched a lot and found a pretty cool way to make a little bit better one, though it takes a whole lot more scripting.
For each of your item slots you name them, itemSlot1, itemSlot2, itemSlot3, and so on..
this is the script for the items -
onClipEvent (enterFrame) {
if (_root.character.hitTest (this)) {
_root.addToslot (this);
}
}
this is for frame one -
currentslotnum = 1;
stop ();
function addToslot (item) {
if (!item.found) {
item._x = eval (”itemSlot” currentslotnum)._x;
item._y = eval (”itemSlot” currentslotnum)._y;
item.found = true;
currentslotnum ;
}
}
make sure that your moving symbol is instance named - character
It worked perfectly for me and i give praise to the person that thought of this beautiful actionscript.
P.S. - Awesty I still think you are the best ^.^
how do you make a flash button link to a html link?
@BulletLuigi: Yes, that is a much better code. I will be using that from now on.
@no1jock:
on(release){
getURL(”URL”);
}
Yea it is awsome, I have been doing adjustments like, making the “I” key change the alpha of the items in the slots and the inventory from 0% to 100% its great.
Oh yea, hate to double post like this, but i wanted to ask you something about the script that i posted for the inventory. I understand all of the script, but I am not familiar with “eval” could you explain that to me?
ty for the code, but this error came up. What do i do?
**Error** Scene=Scene 1, layer=menu, frame=1:Line 2: ‘)’ or ‘,’ expected
getURL(http://www.awestyproductions.com/tutorials/flash-tutorials/making-an-rpg-type-game/#more-33);
good tutorial awesty. Im making an rpg, and i need help with some code. Im having it on my game that when you walk into an object (movieclip,) if you have variables, then it will take you to another frame. I tried this code:
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
if _root.kill = 3;
‘(’
if _root.drug = 14;
‘(’
_root.gotoAndStop(207);
}
is it something like that? cuz it isnt working for me. If it isn’t plz post me the exact code if it isnt 2 much trouble becuz im rubbish at following detailed intrsuctions.. lol :S
thanks
@no1jock
put inverted commas (” or ‘) at the start and end of the web address. it would be something like:
on(release){
getURL(”http://www.awestyproductions.com/tutorials/flash-tutorials/making-an-rpg-type-game/#more-33″);
}
i think thats it
ty for ur help
there is a problem with my game. When you press the W,A,S,D, keys it rotates weird. one minute its in the centre, then when you press the keys, it rotates around the centre can anybody help me pleez?
if you open up your mc the little crosshair is the pivot point so basicly you have to put the midlle of the charecter on the pivot point.
hi, im making an RPG game aswell, does anyone know how to make a shop so that you can click on something that costs £10 and you have £15 it goes into your inventory, and your money goes down to £5, but if you try and click on something that costs £20 it will say ‘not enough money’ and i also need to know how to make it so you can’t buy something more than once, because that would just waste your money.
I also need to know how to make it so that if you buy some gloves and equip them only your gloves change but the rest of your character stays the same. And you can buy everything like chestplates and plate-legs and gloves and weapons and shields and boots and helmets and leather armour all separately and equip the seperately, but still make the character walk right and attack and stuff.
the only way i can think of doing this is to make each part of the body a seperate movieclip, but that takes a very long time and i have to animate them all seperately and position them in the right place on the body. but this leaves the problem of how to make the bodyparts move to the right place when you equip another item. I suppose i could keep them all in the same place and change the alpha of the equipped item to 100% and the alpha of all the other items to 0%
any help is greatly appreciated and i will put your name in the credits of my game.
@??? if you send me the .fla file ill check it out for you. My email is bulletluigi@hotmail.com
@grimm_88 While i am typing this i have flash open and i am trying to make a whole currency system for buying and selling. I’ll post when i figure it out if awesty doesn’t post the exact script when he reads your question.
@grim_88 ive done somthing like that, ill find it for you now. this is the code that i would use, it should work.
on(release){
if(_root.euroe >=10){
_root.inventory.torch.gotoAndPlay(2);
_root.euroe -= 10;
}else _root.euroe =0;
_root.info = “not enough money”;
}
put that on a button of something. the way i have it is that the inventory is a movieclip with a blank first frame and the second frame is full of whatever is in the inventory. when you press a button it opens the inventory and you can choos whatever you want. change euroe to whatever is the variable for your money (ive used a dynamic textbox), torch is the name of the item, that is built the same way as my inventory and awesty’s sword above. info is a dynamic text box i have which tells the player hints and stuff throughout the game. if you want any help or can’t get it to work, email me at: eoin264[at]hotmail[dot]com
sorry, that should be:
}else _root.euroe -= 0;
thanks to both of you bulletluigi and eb264, that helps a lot. to be honest i didn’t expect such a quick reply since i could never find a tutorial on how to do it.
Alright.. I have created a pretty nifty shop/merchant system. Its a pretty long explination ,but with the smallest amount of and the most simple of actionscript. I love actionscript, but i’m not very advanced in it. I am really proud of my creation though. If you would like to see my shop/merchant system .fla or .swf and or an explination of it just send me an e-mail. - bulletluigi@hotmail.com -
(I try not to steal glory off of awesty’s site, you know let the pro explain the stuff on the site. I’ll just tell those or you that are interested in seeing new ways of doing small programs for games in my e-mail. If you are terrified at the idea of making your own shop/merchant program for your game just send me an e-mail and i’ll be more than happy to send it your way with any explaining you need)
@BulletLuigi: Copied right from the flash help:
In Flash 4, eval() was used to simulate arrays; in Flash 5 or later, you should use the Array class to simulate arrays.
“In Flash 4, you can also use eval() to dynamically set and retrieve the value of a variable or instance name. However, you can also do this with the array access operator ([]).
In Flash 5 or later, you cannot use eval() to dynamically set and retrieve the value of a variable or instance name, because you cannot useeval() on the left side of an equation.”
I think you are better off using this[] instead of eval() in the more recent versions of flash. But eval() is still accepted.
@???: Send it to bulletluigi if you want. If he can’t help you, feel free to send it to me.
awestyproductions[@]gmail[.]com.
@grim_88: You are asking alot. I am going to continue this tutorial, so you can equip the sword, and maybe you can figure it out from there.
For the shop, I will try and do a tutorial.
Wait, I just read the other two posts, if bulletluigi and eb264 have solved the problem, I won’t worry about the tutorial.
Btw thank you bulletluigi and eb264, you guys are helping alot. It is hard to answer and solve all these peoples problems.
@Bobkins:
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
if(_root.kill = 3){
if(_root.drug = 14){
_root.gotoAndStop(207);
}
}
}
}
That might work, but Im not really sure what it is supposed to do.
just for my rpg, if you have drestroyed enough drugs and killed enough criminals it just says u win
oi:@ thats my game ur copyin
Awesty couldn’t you just make it this? -
onClipEvent(enterFrame){
if(this.hitTest(_root.man) && _root.kill = 3 && _root.drug = 14){
gotoAndStop(207);}
}
You could, but then if you wanted to put some code if you only wanted it to hit man, you would have to write another line, when for mine, you don’t.
It just depends on what suits you best.
alright thanks, just wanted to see if it would work.
how do u apply code the movie clips to the frame of a mc timeline
Do you mean how to you apply code to a frame inside a MC?
Just double click the MC, click the frame and open the actions panel.
hi does anybody no the code that you put on the man mc that when you press the right arrow key it faces right, and when you press the left arrow key it also faces left, and walks?
hi,
i have just used your RPG movement tutorial to find that when i move the character they didnt just move on the spot it moved up slightly as well, is there a way i can make the character turn on the spot?
Thank You
@jake02- If you mean in a platform type game then this would be the code :
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x = 5;
this._xscale = 100;
gotoAndStop(2);
} else if (Key.isDown(Key.LEFT)){ this._x -= 5
this._xscale = -100;
gotoAndStop(2);
} else if (!Key.isDown(Key.RIGHT) &&
!Key.isDown(Key.LEFT){
gotoAndStop(1);
}
that code only works if you have the second frame of the mc a walking clip and the first frame of that mc an idol position.
@Tom- You probably don’t have your rotation point in the center of your characters head. You can move it by using the Free Transform Tool and selecting your character. Then you should see a white dot. Drag that dot to the center of the characters head.
@Bulletluigi
no i mean like this tutorial, it uses the W,A,S,D keys to rotate and move. I need the same code but i do not have a walking animation, and using the arrow keys.
hi could some1 explain to me what the code is to get the drag and drop function.
@dragonguy
Paste this code on the item(s) you want to drag
on(rollOver)
{
Mouse.hide();
}
on(press) {
startDrag(this);
}
on(release) {
stopDrag();
Mouse.show();
}
on(rollOut)
{
Mouse.show();
}
@jake02 - k in that case you would just do this:
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._rotation = 0;
this._x -= 3;
} else if (Key.isDown(Key.RIGHT)) {
this._rotation = 180;
this._x = 3;
} else if (Key.isDown(Key.UP)) {
this._y -= 3;
this._rotation = 90;
} else if (Key.isDown(Key.DOWN)) {
this._y = 3;
this._rotation = 270;
}
}
For this code to work properly your man should be facing left. You only need 1 MC for this, no extra frames needed. just paste this on the MC’s actions panel that you want to move. Good Luck !
=^.^=
hello i know some stuff about flash.. around intermediate level. I was wondering if somebody could help me make a pet game, where you get money and buy pets, feed them etc and try and keep them alive. Is that a bit too complicated or hard? can some1 please msg back and help me. thnx.
KatyS that is a really awsome idea. Mainly because I haven’t seen one made in flash before. The idea takes me back to those little games that were on keychains. Really the only hard part in making it would be giving the pet the AI to get hungry at a certain time, when it uses the bathroom , ect. It is a really great idea though. I will look into finding a way to make that AI if awesty doesn’t already know. =^.^=
thnx :]
@KatyS: if you wanted, i could try my hand at the AI, I havent done AI before so it mightnt be successful, but I’ll give it a try.
actually, forget about that, its too advanced for me
lmao, sorry for laughing, but both of these posts are in the same day.
@KatyS: Most of the people that post on this site are here learning (mainly the basics), besides Awesty of course. The Flash Teen Prodegy, i’m sure he could help you out if you needed it.
@KatyS: I started to make one of those, but never finished it. You can have the .fla if you want, Im not sure how much I have done (I don’t think it is very much at all).
@BulletLuigi: lol, I am still learning. I have taken some tutorials today. Btw, if you think I am good at flash, have a look at this. It is done by a 14 year old with no use of 3d programs, all actionscript.
http://img176.imageshack.us/my.....ter4ee.swf
Btw, thanks for helping out with answering the comments.
Yea, that cube would be freaking hard to make with actionscript. If he did it without any help that is amazing.
@KatyS: I would think almost all of it would work by variables, apart from the AI part. You would have hunger variables, hunger xp varibles etc. I imagne everything apart from the AI part will be beginner level. You could even make it loose weight by taking it on walks etc etc.
your tuts are great there a godsend but i was wondering how do you make it when you press the x key it triggers a command. like to attack with a sword?
@David: The code would be something like this:
if(Key.isDown(88)){
this.gotoAndPlay(2);
}
}
and on frame two you would have a stop(); action and then on frame 3 you would start the animation of attack. The attack could last two frames, twenty, one hundred, ten, etc, etc.
Or you could have a MC on frame two, that contained the animation, so you could have,
if(Key.isDown(88)){
this.gotoAndStop(2);
}
}
Hey Awesty,
Nice Explanation !
I used a similar (though more complex) system for the RPG I am developing.
Working on new battle system at the moment which will call the attack function on an interval for each PC or Monster in the initiative array. Then call child functions also on intervals to move the attacker to the target x and y, hit them, then move back again.
calling functions on intervals which call other functions on intervals is certainly interesting anyway.
PS. Fash8 AS2 are awesome !!
though saying that can’t wait to get on AS3 with the inbuilt timer class and other added goodies.
Good luck with your further tutorials.
Tom
If you want to look for yourself you can check it out on www.bathwebdesign.com
Please bare in mind that this is still in the early stages of development and is no where near finished.
Other than that enjoy, and I appreciate any comments !
Thanks Awesty !
Tom
That is really cool. I can’t wait to see the finished version.
[…] In this tutorial, we will be continuing the last RPG game tutorial. If you haven’t already taken it, you can find it HERE. […]
Wow thanks Awesty!
blatantly keep you posted for the final version.
Ps. Part 2 tut was great btw!
keep ‘em coming !
hi, your turtorials r good but…. i cant figure out the invintory pick up thing??? when my “man” goes to the item on the ground nothing happens, and i put the coad in that…
lol, ok i kinda figured it out, i made my “man” “pick up the item” but the “small item” is visible before i pick anything up so it dosnt look like i picked up the “item”
lol srry bout all the questions but how do you mae a wall lol like im makinf an RPG game and i need to make houses and stuff so i want to be able to not like walk on the house. sooo yea loluuuh bye
bloomin grammer and spelling these days
@Pedro: On the first frame, try putting this:
_root.smallItem._alpha = 0;
Also try this tutorial:
http://www.awestyproductions.c.....ts-part-2/
By the way, please stop murdering English.
AH! Its not working? Hey awesty, can i have the file that you made to help me because im lost..
Can you just send the .fla to
awestyproductions[@]gmail[.]com
hi, PLEASE awesty help me here, i got everything right but when the char picks the item up, it perfectly goes to 0 alpha, but the item in the inventory doesnt go to 100..
can u help me?
whenever I try to maek the guy walking into amovie clip it only makes a movie clip of one frame
Hey i know this is probly pretty stupid but i havent done alot of making games in flash and i want to get into it.
Here is my problem.
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Clip events are permitted only for movie clip instances
onClipEvent(enterFrame){
Im pretty sure i have everything as you said. please help.
@Seerex: Make sure all the instance names are right.
@somebody: I dont know what you mean.
@Davo: You have to put that on a MC, not the frame.
what?
(T)
You keep making less and less sense everytime you post.
for some reason I cant get the walking animation to work. Can someone help me. I dont quite understand how you can add actionscript to two differnt Movie pics on one movie pic.
Okay… You make one MC of him standing still, and one of him walking. Then you make another blank MC (ctrl+F8). On the first frame of this put the idle MC on it. On the second frame put the walking MC.
this ws really helpful but, can you tell me or direct me to a site that will teach me how to make a game like Mario Bros?
@Jake: There are tutorials on this site that will teach you all you need to know the make a simple game like that.
i would really like to make a rpg game but the prob is i dont under stand where u make the game under
How do you add the actions for the items that you select?
u have to convert the items u select into movie clips and then right click the item and select actions where you will add actions for it
i cant pick up the item but every thing else works
hello awesty, my man just walks right over the item..
tryed reading if others had same problem, but couldnt find anyone… please help me, got everything just as u said, but man just walks over it.. or actually the item is above the man, but he dont pick it up?
How really do i set the alpha to 0???
and lars i don’t think you gave the small item an alpha of 0 and if you did change this :
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
this._alpha = 0;
_root.smallItem._alpha = 100;
}
}
To this:
onClipEvent(enterFrame){
if(this.hitTest(_root.man)){
this._alpha = 0;
_root.smallItem._alpha = 100;
_root.man.gotoAndStop(FRAME);
}
}
well Awesty said that way above.
oops nvm thats if you want your gut to have a sword in his hand when he gets the sword.
lol guy! not gut.
Awesty i have the exact problem as “lars” I know about alpha thing now though it was pretty obvious to find it though.
@Callum: You need Macromedia/Adobe Flash.
@Levi: You have to open the actions panel.
@fb: Make sure you havent missed anything.
@Kurt & Lars: Make sure you have the alpha level right.
I do…
what should the instance name of the big sword be though?
Who ever likes using the arrow keys here is the code you put in the man.
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
this._rotation = 270;
this._x -= 10;
this.gotoAndStop(2);
}else if(Key.isDown(Key.RIGHT)){
this._rotation = 90;
this._x += 10;
this.gotoAndStop(2);
}else if(Key.isDown(Key.UP)){
this._y -= 10;
this._rotation = 0;
this.gotoAndStop(2);
}else if(Key.isDown(Key.DOWN)){
this._y += 10;
this._rotation = 180;
this.gotoAndStop(2);
}else{
this.gotoAndStop(1);
}
}
instead of letters.
@Kurt: It should say in the tutorial, but I have a feeling it doesnt need one.
Me too. I’m making a game half adventure quest half runescape so when you attack something it’s like attacking in adventure quest and you walk around lie in runescape but it would be different places and different graphics and this tutorial is helping alot.
I didn’t really need the timer though lol.
Lol i had instance name and the name you name something when you convert something into a symbol, mixed up.
hey i am working on a flash RPG (with a bit of help from you :D) and I was having trouble with something. I am looking for a way to have the character follow through with the animation even after. I am making my character jump, attack, etc but I can not figure out a way for it to follow through with the animation after you hit the key once (not hold it down). any help will be appreciated.
well i figured out how 2 make it follow through but now i have a problem with jumps, i cant get the jumps to follow through without holding the button and when i can get them through, i cant have the character move with them >
ahh nevermind, fixed all the problems i had with my own jumping system
could you put a download of this flash game?
hey, im stupid can u explain to me what i do after i make a character, i made a sword then i gave it the:
1.
onClipEvent(enterFrame){
2.
if(this.hitTest(_root.man)){
3.
this._alpha = 0;
4.
_root.smallItem._alpha = 100;
5.
}
6.
}
now whats the inventory system a MC? and what action script do i give it? im confusled
I can’t do the thing when you pick up the weapon it doesn’t pop up in the Inventory and i can’t make the copyed one go away.How do i change the alpha also.How do you
I can’t do the thing when you pick up the weapon it doesn’t pop up in the Inventory and i can’t make the copyed one go away.How do i change the alpha also.
@sean: If you follow the tutorial step by step you should be able to figure it out.
@Moulay: Make sure all the instance names and stuff are correct.
Can you send me a Step by Step guide?
No. That is the whole point of the tutorial. If you find it too hard maybe try something easier first.
i want to make the sword a key or a switch to open a door when you get it how can I do it
WHy do you still put AS on MCs? You can’t do that in CS3 so you should start preparing for it.
This tutorial was written a long time ago. I don’t script on MCs anymore and I dont recommend anyone to do so.
When my character goes through a door he ends up on the wrong side of the room how can I fix it?
You need to set his _x and _y again when he enters the room. So if he needs to appear in the middle of the left side you could put:
man._x = 0;
man._y = Stage.height/2;
Need Some Help Makin em run!
I’ve gotten the character to move perfectly but now im wondering how i would make my character run when the ctrl key is held. i’ve made my running frame (3) in my “man” movieclip but i need to know how to make him move faster when he’s running and how to make it so that shift has to be held while the arrow key is pressed to make him move.
Thanks, much appreciated.
I’ll check back for your reply.
Hm, I don’t think I get your question completely but I’m going to tell you how to make him run if your holding the CTRL key.
Type on your character:
onClipEvent(enterFrame) {
if (Key.isDown(Key.CTRL)) {
gotoAndPlay(3);
this._”A” “B”= “C”;
}
}
“A” - either x or y, depending on moving up or down.
“B” - either - or +, depending on moving left/right or up/down.
“C” - speed that you want your character to move. If normal speed of walking was like 5 or something, make this at least 8-10.
I’m making an RPG game and would like some help in a few categories =)
What I have done:
-Sound on/off
-Stat editor (Add stats to different categories and stuff)
-Custom cursor
-Shop system
-all the walls/hitTest
-all the movement
-the hp/mp, and all the other stats
-the guy who heals u for 10 gold xD
-inventory system
-alot of other minor details =)
In-progress:
-battle system, I got all the movement, jumping, and AI down in the battle system, all I need is equiping the items from the inventory to the guy. I can finish the damage stuff from there.
-maps, I’ve gotten the entire map for about 30 minutes - 1 hour of gameplay (when im done with battle system) but need a lil bit more, since the file is still TINY.
Trying to implement, but can’t find the codes/resources:
-pictures, mine are just squares, triangles, circles at the moment…. if u could gimme pictures, would b great xD Btw, I need a picture for main character… all help with images and stuff will be added to credits =)
-hehe how do I test out my preloader? I’ve tried pressing CTRL+enter twice but the screen just goes blank after that lmao. Anywhere to upload to test out the preloader? =)
ooooo 2 things btw:
1. My email is xbzhaox(@)hotmail(dot)com
2. I’ll be able to respond quickly on most days, since apparently Gr. 8 is going to be easier than Gr. 7 xD (Gr. 7 was quite easy in my opinion xD)
Hm…. after like 2-3 hours of trying to work it out, I FINALLY got the equip thingy to work xD Now, I need to know how to put it “on” the guy in combat. Seems it was quite easy acctually lol.
All i did was make the inside of the inventoryitem MC a button, then add:
on(release) {
_root.inventorywand1._x = _root.equipSlot1._x;
_root.inventorywand1._y = _root.equipSlot1._y;
}
Hehe then I put that code all my other items =)
Well you could upload your .swf to http://www.swfup.com to test out your preloader.
By make him run when control is held i ment, when control and the arrow key (left/right/up/down) is held then he’ll run in either direction.
meaning both keys need to be held for him to run.
Omg I give up, typed out something 4 times and its not showing up. -.-
“A” - the new frame of your guy standing still or running position.
“B” - the key that you want pressed down, e.g. LEFT,RIGHT,UP,DOWN etc.
“C” - instance name of your “man”
“D” - either x or y, depending on up or down.
“E” - either - or +, depending on up/down or left/right.
“F” - the new speed you want your guy to run at.
This hasn’t been tested and off the top of my head, so don’t be mad if it doesn’t work lol =)
Hope this helps =)
Heres the first part
You could try:
onClipEvent(enterFrame) {
if (Key.isDown(Key.CTRL)) {
gotoAndStop(”A”);
}
}
Heres the 2nd part LOL I had to split up, 3rd part is the first message up there.
//now, go to the inside of your “man”, and make a new frame of him standing still or in a running position, doesen’t matter. Make it a MC and type this on him://
onClipEvent(enterFrame) {
if (Key.isDown(Key.”B”)) {
_root.”C”._”D” “E”= “F”;
}
}
k SaroVati, i understand all the code i just have no idea where it goes :/
k well i figured it out in my own way
thanks for the helpthough.
If anyone wants to make there character walk on a angle and move faster when control is pressed heres the actionscript code (just substitute this for the one awesty has) also you’ll need to make a running movie clip and make that the frame after your walking one. kthx
LOOK AT POST BELOW FOR CODE.
onClipEvent(enterFrame){
if(Key.isDown(Key.CONTROL)){
runn = true;
}if(Key.isDown(Key.LEFT) && (Key.isDown(Key.UP) && (Key.isDown(Key.CONTROL)))){
this._rotation = 315;
this._y -= 5;
this._x -= 5;
}else if(Key.isDown(Key.LEFT) && (Key.isDown(Key.DOWN) && (Key.isDown(Key.CONTROL)))){
this._rotation = 225;
this._y += 5;
this._x -= 5;
}else if(Key.isDown(Key.RIGHT) && (Key.isDown(Key.DOWN) && (Key.isDown(Key.CONTROL)))){
this._rotation = 135;
this._y += 5;
this._x += 5;
this.gotoAndStop(3);
}else if(Key.isDown(Key.RIGHT) && (Key.isDown(Key.UP) && (Key.isDown(Key.CONTROL)))){
this._rotation = 45;
this._y -= 5;
this._x += 5;
this.gotoAndStop(3);
}else if(Key.isDown(Key.LEFT) && (Key.isDown(Key.CONTROL))){
this._rotation = 270;
this._x -= 5;
this.gotoAndStop(3);
}else if(Key.isDown(Key.RIGHT) && (Key.isDown(Key.DOWN))){
this._rotation = 135;
this._y += 3;
this._x += 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.RIGHT) && (Key.isDown(Key.UP))){
this._rotation = 45;
this._y -= 3;
this._x += 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.LEFT) && (Key.isDown(Key.DOWN))){
this._rotation = 225;
this._y += 3;
this._x -= 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.LEFT) && (Key.isDown(Key.UP))){
this._rotation = 315;
this._y -= 3;
this._x -= 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.LEFT)){
this._rotation = 270;
this._x -= 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.RIGHT) && (Key.isDown(Key.CONTROL))){
this._rotation = 90;
this._x += 5;
this.gotoAndStop(3);
}else if(Key.isDown(Key.RIGHT)){
this._rotation = 90;
this._x += 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.UP) && (Key.isDown(Key.CONTROL))){
this._rotation = 0;
this._y -= 5;
this.gotoAndStop(3);
}else if(Key.isDown(Key.UP)){
this._rotation = 0;
this._y -= 3;
this.gotoAndStop(2);
}else if(Key.isDown(Key.DOWN) && (Key.isDown(Key.CONTROL))){
this._rotation = 180;
this._y += 5;
this.gotoAndStop(3);
}else if(Key.isDown(Key.DOWN)){
this._rotation = 180;
this._y += 3;
this.gotoAndStop(2);
}else{
this.gotoAndStop(1);
}
}
If you use my code above you should get something like this…
Controls
Use Up, Down, Left and Right to move character
Holding Ctrl while moving character will cause character to move faster.
character does run diagonally.
hey SaroVati could you pleeeeeeeeeaaaseeee help me with the shopping system and the equiping system?? pretty please with sugar, cherry or whatever you like on top??
Lol I’m just back from vacation o.O, plus im thinking of making a new RTS game lol. Already got most of it planned out =) I’ll try finishing my rpg tho hehe. The shopping + equiping system = EXTREMELY LONG LOL. It’s really easy once you know the easy stuff, so you should try figuring it out yourself =) It’s pretty much a bunch of:
on(release) {
statements… + u need to look up how to make your item go to inventory once bought. Just takes a long time.
Oh, if you wanna see my game atm, go to this website. It’s me and my friends website for a book we had to make last year in gr. 6 o.O Anyways, the screen will be white for like a year, but then u can play it xD. Hope you enjoy =)
www.freewebs.com/SaroVati/secret.htm
Omfg forgot to tell you again. THE SCREEN IS TOO SMALL!!!!!!!!!! I’m going to make some adjustments soon but right now, you have to click on the screen and drag to see everything…. sry bout that =( YOU WILL NOT SEE THE STATUS BAR IF YOU DO NOT DRAG LOL. Anyways, thats a heads up =)
umm… thanks for telling me that but… your link doesn’t work xD
http://www.freewebs.com/sarovati/secret.htm
o.o i can get on it lol
umm… can you explain to me WHY is the screen white for 1 year?
What screen?
sorry, I was talking to SaroVati about that link up there
http://www.freewebs.com/sarovati/secret.htm
I got lost at
“Once you have that done give that MC an instance name of ‘man’ and put these actions on it”
on which one?
How can I make the character able to travel through an area larger than the Flash stage (essentially a town)?
Sorry if this has already been asked, but I didn’t see it anywhere. Thanks in advance.
sir,
i m trying to make a rpg game but i dnt know how make enemy and attack my hero on contact. i tryed much bt they dont react. btw thanks for ur inventory tutorial, it helped me a lot.
Code doesent work.
Why do alphas? why not simple
visibles
onClipEvent(enterFrame){
if(_root.man.hitTest(this)){
this._visible=false;
_root.smallitem._visible=true;
}
}
Hey, I tried to make this but it goes wrong.
I have an walking man
a standing man
put it together in 1 MC
noticed that on both frame has a stop in script
but now the tricky part where its going wrong… the script… it isnt working.. where should i put it. Cause it cant be put on the man and if i do it on a clear frame, he gives an error and the man flips out!
oke, i fixed it myself..
But could you tell next time wich AS you use xD
Cuz you needed to make it in AS 2.0
and im always using 3.0
thx anyway ^^
Instead of make the alpha turn to 0, we can just make it invisible like _visible = false;
Anyway, where are you? Where have you been? I miss you so much.
Are you watching us? Or you aren’t there now?