HOME | DD

Published: 2006-10-01 16:41:20 +0000 UTC; Views: 29018; Favourites: 250; Downloads: 608
Redirect to original
Description
[Edit] This tutorial is outdated! It can still be used for learning some basics for Flash but it is advised you find newer tutorials! I have a new video tutorial series on youtube ( [link] ) for making a Flash game using AS3. [/Edit]Want to make a RPG(role palying game)?
Well this is the tutorial for you.
Works in mx pro 2004 and up as far as I know and possibly lower.
Related content
Comments: 134
Computer-Turret In reply to ??? [2014-08-01 23:44:47 +0000 UTC]
This tutorial is so outdated it's obsolete. This was written in AS1... many years ago, nowadays we're up to AS3 which is a real full programming language. If you're interested I have a full video series on youtube with source code at: www.youtube.com/playlist?list=…
It goes over how to make a game in Flash AS3 and is an all-round improvement over anything as ancient as this.
👍: 0 ⏩: 1
Sunimacrud [2013-01-06 22:35:30 +0000 UTC]
I have Anime Studio Debut, but it works with Flash files n' such.
Do you think it'll work?
👍: 0 ⏩: 0
Macaroll [2012-11-09 06:33:39 +0000 UTC]
---E Nice tutorial! And it's perfect because I'm using Flash Professional 8 as well!~ I'll be sure to try making a game with this!~ Thank you very much!~
👍: 0 ⏩: 1
Computer-Turret In reply to Macaroll [2012-11-09 20:03:13 +0000 UTC]
Word of warning, this is extremely outdated. It's written in AS1, which is obsolete at this point.
👍: 0 ⏩: 1
Macaroll In reply to Computer-Turret [2012-11-10 08:24:14 +0000 UTC]
---E Thanks, but I'll try it anyway. Also, what's AS1?
👍: 0 ⏩: 1
Computer-Turret In reply to Macaroll [2012-11-10 14:30:19 +0000 UTC]
Action Script 1, or rather the first version of Action Script, the language Flash uses. AS1 is simply a scripting language. AS2 has some OOP (object oriented programming) principles in it, and AS3 is fully OOP and not just a scripting language.
In AS1 you tend to put code directly on the frame's or object's "actions panel". While in AS2 and AS3 you do the more accepted form of having separate AS files.
If as you say, you're still using Flash 8, then this tutorial will still be of use to get used to coding in small amounts and how Flash itself functions. Just don't make the mistake I made of writing in AS1/AS2 for years and not switching!
👍: 0 ⏩: 1
Macaroll In reply to Computer-Turret [2012-11-12 00:34:46 +0000 UTC]
---E okay, that's great!~ Thank you very much!~ This will be of much help!~ Reely, thank youuuuuuuu!
👍: 0 ⏩: 0
HannahRose-photos [2012-08-25 17:51:32 +0000 UTC]
Do you know where I can download flash 8 pro? Is it free?
👍: 0 ⏩: 1
Computer-Turret In reply to HannahRose-photos [2012-08-25 21:06:57 +0000 UTC]
It is not free. Flash has always been a paid product although there is a free trial on adobe's website [link] Do note that Flash is up to version CS6 now, Flash 8 is very old (and this tutorial). Not exaggerating when saying this tutorial is obsolete.
👍: 0 ⏩: 0
ReminiscentFate [2011-11-18 22:55:24 +0000 UTC]
Hello,
I am currently making a flash based rpg game, and started working on collision detection (I'm fairly new to flash).
I have a (somewhat) working 8 movement character with walking frames, and various blocks for collision testing.
Right now i managed to get the borders to work with "limitStageBoarder", it's the objects within i have troubles with.
The objects i have for collision testing detect my character hitting it, but many problems occur, and i can't figure out why.
Lets say i pressed the "Up" key to move up towards the object. It will hit it, but it will vibrate on it.
Not only that, but if i pressed the down key, it will go through the wall.
before you look at the code, you should know that balllayer.
Here is the code:
ball.stop();
ball.walking.stop();
var rightArrowoolean;
var leftArrowoolean;
var upArrowoolean;
var downArrowoolean;
var speed:int=5;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(Event.ENTER_FRAME, everyFrame);
function keyPressed(event:KeyboardEvent):void {
ball.walking.play();
if (event.keyCode==Keyboard.RIGHT) {
ball.gotoAndStop('walking');
rightArrow=true;
ball.scaleX=-1;
}
if (event.keyCode==Keyboard.LEFT) {
ball.gotoAndStop('walking');
leftArrow=true;
ball.scaleX=1;
}
if (event.keyCode==Keyboard.UP) {
ball.gotoAndStop('back');
upArrow=true;
}
if (event.keyCode==Keyboard.DOWN) {
ball.gotoAndStop('front');
downArrow=true;
}
}
function keyReleased(event:KeyboardEvent):void {
ball.walking.stop();
if (event.keyCode==Keyboard.RIGHT) {
rightArrow=false;
}
if (event.keyCode==Keyboard.LEFT) {
leftArrow=false;
}
if (event.keyCode==Keyboard.UP) {
upArrow=false;
}
if (event.keyCode==Keyboard.DOWN) {
downArrow=false;
}
}
function everyFrame(event:Event):void {
var oldx=ball.x;
var oldy=ball.y;
limitStageBorder(ball);
if (! ball.hitTestObject(box)) {
if (rightArrow) {
ball.x+=speed;
}
if (leftArrow) {
ball.x-=speed;
}
if (upArrow) {
ball.y-=speed;
}
if (downArrow) {
ball.y+=speed;
}
}else {
if (rightArrow) {
ball.x-=speed;
}
if (leftArrow) {
ball.x+=speed;
}
if (upArrow) {
ball.y+=speed;
}
if (downArrow) {
ball.y-=speed;
}
}
}
function limitStageBorder(object:MovieClip) {
var objectHalfWidth:uint=object.width/2;
var objectHalfHeight:uint=object.height/2;
if (object.x+objectHalfWidth>stage.stageWidth) {
object.x=stage.stageWidth-objectHalfWidth;
} else if (object.x - objectHalfWidth <0) {
object.x=0+objectHalfWidth;
}
if (object.y-objectHalfHeight<0) {
object.y=0+objectHalfHeight;
} else if (object.y + objectHalfHeight > stage.stageHeight) {
object.y=stage.stageHeight-objectHalfHeight;
}
}
Any help is appreciated .
0
👍: 0 ⏩: 1
Computer-Turret In reply to ReminiscentFate [2011-11-19 15:06:28 +0000 UTC]
Well first you should know that hitTestObject only checks the bounding box of an object, so for complex shaped objects you'll end up "hitting" it when you are not.
If you do it direction by direction you'll likely get better results. Also you shouldn't say else move him in reverse since he must be touching it because the User could be pressing any key once hitting the object, thus they can glitch past anything.
Maybe something like only move right/left/up/down if you're not touching it in that direction, and use a while loop to (seemingly) instantly move you to the correct side if you are touching the wall [note you can add more points to check for the hit for greater accuracy, I'm only checking the 4 main points]
if (rightArrow&&!box.hitTestPoint(ball.x+ball.width/2,ball.y,true)) {
ball.x+=speed;
}
if (leftArrow&&!box.hitTestPoint(ball.x-ball.width/2,ball.y,true)) {
ball.x-=speed;
}
if (upArrow&&!box.hitTestPoint(ball.x,ball.y-ball.height/2,true)) {
ball.y-=speed;
}
if (downArrow&&!box.hitTestPoint(ball.x,ball.y-ball.height/2,true)) {
ball.y+=speed;
}
while(box.hitTestPoint(ball.x+ball.width/2-1,ball.y,true){
ball.x--;
}
while(box.hitTestPoint(ball.x-ball.width/2+1,ball.y,true){
ball.x++;
}
while(box.hitTestPoint(ball.x,ball.y+ball.height/2-1,true){
ball.y--;
}
while(box.hitTestPoint(ball.x,ball.y-ball.height/2+1,true){
ball.y++;
}
Or something like that, hope that helps. It's a kind of trick but it works. You can always look into getBounds() on adobe live docs if you want to try that as well.
👍: 0 ⏩: 0
kat1004 [2011-10-27 11:48:12 +0000 UTC]
Cool! Im making a game @ school, and this is very helpful for me!
👍: 0 ⏩: 0
jimbobfreddygames [2011-10-01 16:29:26 +0000 UTC]
hi i love your game/s
i would love to buy a copy to put on a website
i will pay around £300
please reply and email the swf file to booboojim@hotmail.co.uk and if i decide to buy it and i will ask some people if it would be good on the website i would then need the.fla file .
but i hope you accept and if you have any more games please feel free to send them to me
as they would be greatly appreciated
for more of a chat add me on facebook my fb is ewan clementson and my page is jimbobfreddy games
i will get back to you on if i want to buy it
👍: 0 ⏩: 0
spartaboy [2011-09-12 17:55:23 +0000 UTC]
hey i want to make a rpg but i just want to to save one thing. here is the script i used a answer today would be most appreciated.
stop();
function saveGame(){
myLSO = SharedObject.getLocal("guy");
if(myLSO.data.myObj == undefined){ // No object exists
trace("Saved Game");
}
else{
trace("Overwrote Saved Game");
}
myObj = {};
myObj.objArray = new Array();
myObj.objArray[0] = health;
function loadGame(){
myLSO = SharedObject.getLocal("guy");
if(myLSO.data.myObj == undefined){ // No object exists
trace("No Saved Game");
}
else{
trace("Loaded Game");
Health = myLSO.data.myObj.objArray[0];
}
}
}
👍: 0 ⏩: 1
Computer-Turret In reply to spartaboy [2011-09-13 01:09:15 +0000 UTC]
So what is the problem? When you want to save the variable "health" call saveGame() and when you want to load the value call loadGame(). If you don't think it's saving or loading correctly try tracing the value of health during save/loading.
Do not in your loadGame function you use "Health" and in your saveGame function you're using "health". It is case-sensitive and will treat that as two variables.
👍: 0 ⏩: 0
JayTheWulven [2011-06-24 18:15:58 +0000 UTC]
Because of this tutorial, after almost 6 years of searching the internet I was final able to make a real RPG based off of stats and leveling up. The question I have however is how would you implement a "defense" variable for a character in his or her stats? I can create the value itself but the problem im having is making it work so that when the enemy attacks this character his HP is depleted based on his actual defense and not JUST by the enemies attack variable.
👍: 0 ⏩: 1
Computer-Turret In reply to JayTheWulven [2011-06-24 19:01:19 +0000 UTC]
Well I'm glad you liked this ancient, nearly obsolete tutorial! I'm always surprised how many faves it still gets today...
As for your problem the easiest way would be to deduct the defence stat from the amount of health you would be taking away. For instance
if:
heroHealth=100
enemyAttackDamage=10
heroDefense=5
and you did:
heroHealth-=enemyAttackDamage-heroDefense
it would be like this
100-(10-5)=100-5=95
so the hero now has 95 health because his 5 defense was taken into account with the 10 damage of the enemy.
To make sure the defense stat is not more than the damage being dealt (resulting in negative numbers and healing the hero instead of hurting) you can do a simple if statement:
//if there is more defense than damage being dealt
if(enemyAttackDamage
heroHealth-=1;
}else{
//calculate how much damage to remove and remove it
heroHealth-=enemyAttackDamage-heroDefense
}
Hope that helps.
👍: 0 ⏩: 1
JayTheWulven In reply to Computer-Turret [2011-06-24 23:44:14 +0000 UTC]
thanks so much for your help
👍: 0 ⏩: 0
itty-bitty-stock [2011-06-23 05:59:04 +0000 UTC]
Jesus Christ, this tutorial is awesome. I love it! Am creating awesome mega-project from this, but I'm having to improvise on a lot of things to fit my needs. Definitely going in my s!
👍: 0 ⏩: 0
KawaiiSairen [2010-11-03 18:46:19 +0000 UTC]
oh and btw (sorry for nagging)
how do the playes see what stats they got?
👍: 0 ⏩: 0
KawaiiSairen [2010-11-03 18:43:55 +0000 UTC]
great tut!
but i have a question, is there a way to make the stats so that they are not random?
like forexamle you have a + and a - button and when you press + the stats go 1 up
and when you press - the stats
go down
hope you understood ^_^'
👍: 0 ⏩: 1
Computer-Turret In reply to KawaiiSairen [2010-11-03 23:56:10 +0000 UTC]
Hmm check out this comment.
[link]
You should be able to work it out from that. If still not I'll help you out but I've been so busy with University lately.
👍: 0 ⏩: 1
KawaiiSairen In reply to Computer-Turret [2010-11-04 16:05:28 +0000 UTC]
ok thanks but on my game then you press the + button but the number dosen't change or well there isn't a number at all there, i made the text an Dynamic text and i called them
for money, smarts ect. but still no number comes, i used this code for one of the places:
on (release) {
if (_root.money > 0) {
_root.money += 10;
}
}
but nothing happens
can you help?
it's ok if you can't answer in a while because of school but please answer as fast as you can.
👍: 0 ⏩: 0
Arctic-camel [2010-09-06 22:41:18 +0000 UTC]
The button thing actually works for Adobe CS4, as long as you use Actionscript 2.
👍: 0 ⏩: 0
BudHash [2010-08-23 05:56:09 +0000 UTC]
im having some trouble,
so i made a square just to test out the running into building thing.
i made it an mc, put the script in, and the script worked. i had no errors at all.
so then i made it into another mc and made the instance map, like you said.
after all of that it still wont work.
my character still walks right past the square.
there was no errors what-so-ever so i dont know what im doing wrong...
it would be awesome if you could help me out or send some screenshots on how to do it cause i must be missing something..
👍: 0 ⏩: 1
Computer-Turret In reply to BudHash [2010-08-23 14:29:34 +0000 UTC]
Well this tutorial is pretty much obsolete, learning it wont help in the long run. (It's done in AS1, AS3 is the standard now).
What version of Flash are you using?
I've made this basic (very) of and RPG with stats, naming your hero, movement and wall hittest in AS2 (basically one tiny step up from AS1).
Here's the example: (I saved as Flash 8 just in case).
Swf: [link]
Fla: [link]
👍: 0 ⏩: 0
Straww [2010-07-12 10:05:56 +0000 UTC]
im stuck with the function saveGame(){
myLSO = SharedObject.getLocal("guy");
if(myLSO.data.myObj == undefined){ // No object exists
trace("Saved Game");
}
else{
trace("Overwrote Saved Game");
}
myObj = {};
myObj.objArray = new Array();
myObj.objArray[0] = name;
myObj.objArray[1] = strength;
myObj.objArray[2] = money;
myObj.objArray[3] = charm;
myObj.objArray[4] = karma;
myLSO.data.myObj = myObj;
}
function loadGame(){
myLSO = SharedObject.getLocal("guy");
if(myLSO.data.myObj == undefined){ // No object exists
trace("No Saved Game");
}
else{
trace("Loaded Game");
name = myLSO.data.myObj.objArray[0];
srength = myLSO.data.myObj.objArray[1];
money = myLSO.data.myObj.objArray[2];
charm = myLSO.data.myObj.objArray[3];
karma = myLSO.data.myObj.objArray[4];
}
}
how do i make a frame DX? sorry im new
👍: 0 ⏩: 1
Computer-Turret In reply to Straww [2010-07-12 15:54:58 +0000 UTC]
If you don't know how to use the timeline and make frames I think you need to start smaller, a lot smaller.
[link]
For the /very/ basics of making a frame.
👍: 0 ⏩: 1
Straww In reply to Computer-Turret [2010-07-13 14:16:12 +0000 UTC]
Ohmygawsh thank you so much <3
👍: 0 ⏩: 0
Ai-Tinyfox [2010-06-25 11:41:40 +0000 UTC]
I have a promblem in the part "gaining stats". It adds more "1" into my dynamic text instead of replace the "0" number with 1, 2 or 3..ect
It's like: 0 -> 01 -> 011 -> 0111 -> ect
Help me please!
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-25 14:53:19 +0000 UTC]
It's treating it like a string.
For instance:
var username:String="AI";
username+="-Tinyfox" would result in AI-Tinyfox
Make sure it's defined as a number. Since this tutorial is HORRIBLY outdated (AS1 is obsolete) it doesn't cover things like having to define the type of a variable like AS3 does.
var strength:Number=10;
strength+=1;
would result in 11.
👍: 0 ⏩: 1
Ai-Tinyfox In reply to Computer-Turret [2010-06-25 15:41:07 +0000 UTC]
Thanx, I got my number 11. But it stoped there and didn't plus any more 1 into the dynamic text. What should I do now?
10->11->11 (it stops right there)
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-25 20:01:20 +0000 UTC]
Just call strength+=1 anytime you want to add one to it, such as on a button. My example only did it once because it was just that, an example. Also don't instantiate the variable every time, just set it once (in this tut I think it gives a random default value between 1-10). Then add to it by other means later when the character works out for instance.
👍: 0 ⏩: 1
Ai-Tinyfox In reply to Computer-Turret [2010-06-26 11:23:23 +0000 UTC]
... So how can I make my button do it twice and more...?
( And when I put this AS into my button:
on (release) {
var strength: Number+=1
}
It said I encountered a prolem >_<)
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-26 13:52:12 +0000 UTC]
var strength:Number=1
is saying you are making a VARIABLE called STRENGTH (hence var) and it is a NUMBER that EQUALS 1.
Now that your variable is created (and you only want to do it once, so only call that line once somewhere on the timeline) you don't have to say all those things when you want to add to it. Now on your button you can simply say
on (release) {
strength+=1;
}
Please note that coding in AS1 and on movieclips is obsolete and you're basically learning the worst possible way to do things.
👍: 0 ⏩: 1
Ai-Tinyfox In reply to Computer-Turret [2010-06-26 14:01:56 +0000 UTC]
Let me explain my situation:
1. I wanted my button to increase the number in my dynamix box.
2. The AS:
on (release) {
strength+=1;
}
makes my button ads 1 after 0.
3. You totally lost me now...
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-26 14:31:41 +0000 UTC]
Yes but where do you define what strength is?
If you don't Flash will use it's crappy assumption abilities and since you probably have it as a textbox assumes a string.
Ok in the tutorial it does this to set default values.
on(release){
_root.strength=random(10)
_root.smarts=random(10)
_root.money=random(10)
_root.charm=random(10)
}
Change it to
on(release){//this is the roll for stats button
var strength:Number=random(10);
var smarts:Number=random(10);
var money:Number=random(10);
var charm:Number=random(10);
}
then on your other button you can say
on(release) {
strength+=1;
}
👍: 0 ⏩: 1
Ai-Tinyfox In reply to Computer-Turret [2010-06-26 15:00:28 +0000 UTC]
Ok... I'll explain... again:
1. I understand the roll for stats part, thank you.
2. I'm using Flash 8, I created a mysterious dynamic text box says "0" with its var as strength, after that I created a button says "kill" with its AS:
on(release) {
strength+=1;
}
> I pressed my button and it ads "1" after my "0"...
3. I thank you for your nth help and sorry that I'm such a totally-clueless-flash-noob that bothered you but... you lost me... again... sorry ><
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-26 16:27:30 +0000 UTC]
Here I did a basic engine for you to look at and use as you will.
swf: [link]
fla: [link]
I also put it all on the timeline for you, because it's better practice and I think you'll find it much easier to understand and find everything. I commented the code in the fla.
👍: 0 ⏩: 1
Ai-Tinyfox In reply to Computer-Turret [2010-06-26 16:37:46 +0000 UTC]
Waaaa, thanks, I thought you quit!!! THANKS THANKS THANKS THANKS THANKS ect..
I'll check them out >_<
THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!!!
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-26 16:41:09 +0000 UTC]
Really it's no big deal haha. If you have any questions feel free to ask and I'll do my best.
👍: 0 ⏩: 1
Ai-Tinyfox In reply to Computer-Turret [2010-06-26 17:08:07 +0000 UTC]
THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
I would've give you more than 1 llama badge if I could >_<
Thanks again!!!!
But... (hate the but *~*)
I don't know how to minus the stats...
Heeeeeeeelp...! (Of course if you have time)
👍: 0 ⏩: 1
Computer-Turret In reply to Ai-Tinyfox [2010-06-26 20:17:47 +0000 UTC]
Well adding to stats you use "+=" so taking away you'd use.... "-=" !!!!!!!
strength-=1;
👍: 0 ⏩: 1
| Next =>