Go Back   kirupaForum > Flash > Game/AI Programming

Reply
 
Thread Tools Display Modes
Old 04-18-2004, 04:06 PM   #1
denacioust
Too Hot For Radio
 
denacioust's Avatar
The basics of an RPG (role-playing game)

The basics of an RPG (role-playing game)
Taken from flashbox.proboards15.com (my site)
__________________________________________________ _____



Note: This is based on the Stick RPG game but I’ve added in some other stuff too.
Now bear with me I'm not sure if this will work because I just wrote this all without testing it so please report any errors.


First-of-all what you want to do is decide:
1. Your characters occupation(s) – Start off by deciding what you want your Playable Character to do. Pick a job that blends in with your characters surroundings e.g. it would work well if you had your character being a Mafia Hit man if he/she lived Italy

2. The characters appearance and personality – Decide now what your character should look like and their distinguishing character traits e.g. shifty eyes, giant head, Red, strawberry blonde, hair etc. Now pick a personality to match the look i.e. a person with shifty eyes could be a criminal or a drug dealer etc. And lastly pick a name for your character, a suitable name one which almost gives away the characters personality.

3. Pick your enemies, decide your friends – Your character will definitely need an enemy, pick a reason why and how that person is your enemy. If you’re going to have a no. of enemies you’ll need friends, someone to help you get the job done…

4. The Character’s Background – Lastly what you want to do is to decide the following questions:
• Where does your character come from?
• Who does he/she interact with? (Mafia stuff like that)
• Why is your character in the position they are in? (Unpaid debts to the Mafia etc.)


Now that you’ve got the background it’s time to open up Flash. Open up a new flash document. To start off draw out your character, from a birds-eye-view (from the top), animate it walking in an upward direction, the other directions will be handled in the action script of the game. Label the character “man.”
With your character done it would be best just to draw the background now and keep all the drawing and animating together. Draw your map; ignore logic when drawing it by showing the front and top of every building so you know what’s going on in each building. Your map should be several times the size of the visible screen in your game so that the map can scroll, the map only will move and not the character. You’ll need to add in some extra frames to show the inside of the buildings.

Now what you need to do is an inventory for your game. At the bottom of the screen draw any number of boxes i.e. these boxes will show up your items when you find them. Give these boxes the instances slot1, slot2 etc. With these boxes you’ll want to put in around five textboxes, one for health, occupation, days into the game, name, strength, charm and intelligence. Give each of the textboxes the variable (not instance name!) of what they are (just the one word.)

Now to start off your game insert a new scene (Insert --> Scene) above the existing scene(s) name this scene “Setup”. Name the already existing scene “game” This scene will be used to set-up all the variables. Insert an input text-box give it the variable “name.” The user then can input their own name into the textbox. Make sure you click the box labelled “show border around text” and Max. characters to seven, or whatever you want. Insert another input textbox for Days into the game and do the same for that but set the maximum characters to two and the allowed characters to just be numbers. Insert three more dynamic textboxes for Strength, Charm and Intelligence. Now for some action script insert this into the first frame:

Code:
 function randomise () {
_root.strength=random(10)
_root.charm=random(10)
_root.intelligence=random(10)
}
By declaring it as a function it can be used again with a randomising button. Draw a “roll again” button. Give it actions.
Code:
 on (release) { randomise(); }
That will randomise the values by the click of that button. Place another button on the stage with the writing “Go” or “Play” or something to that extent in it. Give the button actions
Code:
on (release) {
	gotoAndStop("Game", 1);

}
And for the actual game…
Go to your “Game” scene and place in your character and the background. Select align (ctrl + k ) and centre your character on stage. Give the background the following actions.

Code:
onClipEvent (load) {
movespeed = 2;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT)) {
	_x-= movespeed;
	}
	if (Key.isDown(Key.LEFT)) {	
	_x+= movespeed;
	}
	if (Key.isDown(Key.UP)) {	
	_y+= movespeed;
	}
	if (Key.isDown(Key.DOWN)) {	
	_y-= movespeed;
	}
	}
And give your character these actions
Code:
onClipEvent (load){movespeed = 0;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT)) {
		play();
		_rotation = 90;
		_x+= movespeed;
	}
	if (Key.isDown(Key.LEFT)) {
		play();
		_rotation = 270;
		_x-= movespeed;
	}
	if (Key.isDown(Key.UP)) {
		play();
		_rotation = 0;
		_y-= movespeed;
	}
	if (Key.isDown(Key.DOWN)) {
		play();
		_rotation = 180;
		_y+= movespeed;
	}
	if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
		_rotation = 45;
	}
	if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
		_rotation = 315;
	}
	if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
		_rotation = 135;
	}
	if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
		_rotation = 225;
	}
}
Now place these actions in the frame.
Code:
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++;
	}
}
And give the items that can be found these actions

Code:
onClipEvent (enterFrame) {
	if (_root.character.hitTest (this)) {
		_root.addToslot (this);
	}
}
Now place a button somewhere, it should be one to add on to your intelligence e.g. a study button in a school. Place these actions in the frame that button is placed in:

Code:
if (moneyneeded>=moneyrequired) {
		money=1
	}
And give the button these actions
Code:
on (release) {
	strength+=(10*money)
}
And that can be used for all the different things required for the game e.g. Buying beer and stuff.

Moving into buildings. Inside the map place a square outside the door with an instance of "step"
Code:
onClipEvent (enterFrame) {
	if (_parent.man.hitTest (this)) {
		_parent.gotoAndStop("insidebuildingframe");

	}
}
Thats really all I need to show you without repeating myself or others.
Here are a few extra tutorials which may help you.

http://forums.xgenstudios.com/viewtopic.php?t=355 - Saving games
http://forums.xgenstudios.com/viewtopic.php?t=242 - Preloaders
http://forums.xgenstudios.com/viewtopic.php?t=7751 - Functions
http://forums.xgenstudios.com/viewtopic.php?t=8395 - Actionscript basics

__________________
denacioust is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?

Old 04-19-2004, 12:57 AM   #2
zeka
DNA Flasher
 
zeka's Avatar
Great Work!

Thanks! I have been looking for a tutorial on RPG Games for ages. I couldn't get mine to work, and had to gather scraps of info from all around. Now there is this-a great tutorial. :Thumb:

Zeka

__________________
The New Me
zeka is offline   Reply With Quote
Old 04-24-2004, 04:06 PM   #3
denacioust
Too Hot For Radio
 
denacioust's Avatar
Thanks!

__________________
denacioust is offline   Reply With Quote
Old 04-28-2004, 09:11 AM   #4
r1cem4n
Local Deity
Location Holly Michigan

Posts 13
excellent tutorial! a lot of help. thanx

__________________
i see you hearin me
r1cem4n is offline   Reply With Quote
Old 05-02-2004, 11:30 PM   #5
BlueBoots
Dr Marten cured my ill...
 
BlueBoots's Avatar
Isn't there already a Kirupian Tutorial about RPGs? One that doesn't just hand it to yall on a plate?

__________________
Blue like the sky, Blue like the sea, Blue like the colour, Blue like me!
BlueBoots is offline   Reply With Quote
Old 05-07-2004, 03:53 PM   #6
signifer123
Ha!
 
signifer123's Avatar
can you teach how to make it so you don't walk through the buildings?
signifer123 is offline   Reply With Quote
Old 05-07-2004, 11:10 PM   #7
zeka
DNA Flasher
 
zeka's Avatar
ya was gonna ask the same question

__________________
The New Me
zeka is offline   Reply With Quote
Old 05-10-2004, 03:52 PM   #8
Jabird
POOP!!!
 
Jabird's Avatar
Location Dongola, IL (dont even ask)

Posts 61
Thanks alot, I was interested in game design for some time, until i realized i needed to know alot more, once i get home, i will try some of this.

Thanks,
Jabird
Jabird is offline   Reply With Quote
Old 05-27-2004, 09:31 PM   #9
Robman1
n00b
Location somewhere

Posts 133
its a good tutorial! however newbs need a bit more explanation rather than just here u go. i was wondering if you could go a bit more into depth with the inventory, skills, and not walking through buildings
Robman1 is offline   Reply With Quote
Old 05-28-2004, 07:38 AM   #10
signifer123
Ha!
 
signifer123's Avatar
once i remeber how i got it to stop going through buiolding this way i'll post here

__________________
Skype Me?
hitTest on my system does 4250 hitTests in 1/12 of a second.
signifer123 is offline   Reply With Quote
Old 06-03-2004, 05:06 PM   #11
signifer123
Ha!
 
signifer123's Avatar
Ok building stop

This is for stopping when a guy hits a building:"place this on the guy"

Code:
 onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
play();
_x+= 5;
if (_root.guy.hitTest(_root.stop,)) {
this._x -= 5;
}
}
if (Key.isDown(Key.LEFT)) {
play();
_x-= 5;
if (_root.guy.hitTest(_root.stop)) {
this._x += 5;
}
}
if (Key.isDown(Key.DOWN)) {
play();
_y+= 5;
if (_root.guy.hitTest(_root.stop)) {
this._y -= 5;
}
}
if (Key.isDown(Key.UP)) {
play();
_y-= 5;
if (_root.guy.hitTest(_root.stop)) {
this._y += 5;
}
}
}

__________________
Skype Me?
hitTest on my system does 4250 hitTests in 1/12 of a second.
signifer123 is offline   Reply With Quote
Old 06-05-2004, 11:53 AM   #12
lucas92
Techtronik Graphics Guru
Location The planet earth

Posts 572
How do i make it so when you release the key the main character movie will go back to the first frame. Thanx

__________________
I can't think of anything funny or clever or interesting to say, so I just won't say anything at all... Doh!
lucas92 is offline   Reply With Quote
Old 06-05-2004, 03:30 PM   #13
signifer123
Ha!
 
signifer123's Avatar
use this on the button to go back to the main screen:

on (release) {
gotoAndStop("Game", 1);

}

__________________
Skype Me?
hitTest on my system does 4250 hitTests in 1/12 of a second.
signifer123 is offline   Reply With Quote
Old 06-05-2004, 09:26 PM   #14
lucas92
Techtronik Graphics Guru
Location The planet earth

Posts 572
I am talking about the guy you move around and i am talking about a key, not a button

__________________
I can't think of anything funny or clever or interesting to say, so I just won't say anything at all... Doh!
lucas92 is offline   Reply With Quote
Old 06-06-2004, 06:58 AM   #15
signifer123
Ha!
 
signifer123's Avatar
ok:

onClipEvent(keyDown) {
if (Key.isDown(87)) {
gotoAndStop("Game", 1)
}
}

ohh ya thats the "w" key becasue you never specified

__________________
Skype Me?
hitTest on my system does 4250 hitTests in 1/12 of a second.
signifer123 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:42 PM.

SHARE:

SUPPORTERS:

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com