How to do A RPG Turn Based Flash AS3

14 posts

Flag Post

hi, got good day to everyone, im actually using flash for a about a few months, and I tried to create a turn based game in flash as3, hope somebody can help me here thanks in advance.

 
Flag Post

You might want to elaborate a bit more upon what you actually want help with.

 
Flag Post

Well, It’s different based on whatever style you do it with. Here is how I did it:

Steps:
0.) Initialize the game – Here is where you arrange and display the graphics. This is also where you initialize the turn speeds, depending on your rules. You can have a “preemptive strike” or “back attack” based on the conditions.

1.) Check conditions – Check if everybody in the party, or every enemy is still alive. This will trigger the victory/defeat functions. You can also run turn conditions such as status effects here.

2.) Calculate the turn – This is where you check whos turn is it. Based on the turn you will either run player commands (3a), or run enemy ai (3b).

3a.) Show Command Menu – This is where you will show the menu for the player. Depending on what the player will click it should end up passing a SPELL.

3b.) Enemy AI – You can randomize the enemy actions here depending on your parameters. It will eventually pass a SPELL.

4.) Run the Spell Effect – This is where you will display the spell effect.

5.) Run the Spell Damage – This is where you calculate the damage output from the spell. You can then show the damage done by the spell. I prefer to separate the spell effect from the damage calculation because usually the effects get in the way of the text display. You can combine them however you want.

6.) Repeat Check Conditions (Step 1)

 
Flag Post

An example of Game Over:

if(player1health <= 0){
gotoAndPlay(“gameover”);
}

 
Flag Post

Sorry for late reply, @Danishdragon, what I want is a game like epic battle fantasy III if you played it here in kongre, like there’s a hero, you can walk, inventory system, inventory system is just like upgrading the weapon, hope you can help me guys ! there’s also shops that sells potion, mana potion etc. thanks.

 
Flag Post
Originally posted by RalphSpoon:

Sorry for late reply, @Danishdragon, what I want is a game like epic battle fantasy III if you played it here in kongre, like there’s a hero, you can walk, inventory system, inventory system is just like upgrading the weapon, hope you can help me guys ! there’s also shops that sells potion, mana potion etc. thanks.

I’d like to draw a complex painting of a bird eye view of new york using a acrylic medium please. Tell me how, anyone?

 
Flag Post

A turn Based RPG is quite advanced and is hard to make. You said you were fairly new to flash.
I recommend you make a simple platformer and slowly upgrade it and add more features to it. Then after you really know what you’re doing go for the turn based RPG.
The shop and the inventory are harder than you might think.

 
Flag Post

@shadow_craver, yes, i’ve done side scroller, shooting, maze games all made in flash as3, and yes im pretty scared to know the fact that those 2 are very hard to do(inventory and shop ) + saving it(shared objects).

 
Flag Post

I still code in AS2 (I learnt it years ago, forgot it and started again, but still don’t like AS3 :P) but if the saving system in AS3 is similar to that of AS2, saving is actually rather easy.

 
Flag Post

Try this:

var MyGame:flash.games.RPG;
MyGame = new RPG(); // No need for parameters at creation, you can customize later.
// Customization
MyGame.quality = RPG.AWESOME;
MyGame.badges = true;
MyGame.money = Sponsorship.money.LOTS;

Good luck.

 
Flag Post
Originally posted by Ace_Blue:

Try this:

var MyGame:flash.games.RPG;
MyGame = new RPG(); // No need for parameters at creation, you can customize later.
// Customization
MyGame.quality = RPG.AWESOME;
MyGame.badges = true;
MyGame.money = Sponsorship.money.LOTS;

Good luck.

Hate to nitpick but there’s at least one syntax error in that, I think you mean


var MyGame:flash.games.RPG;
MyGame = new RPG(); // No need for parameters at creation, you can customize later.
// Customization
MyGame.quality = flash.games.RPG.AWESOME;
MyGame.badges = true;
MyGame.money = Sponsorship.money.LOTS;

You never imported flash.games.RPG :)

 
Flag Post

FlashDevelop inserts the import line for you! But you’re right, I shouldn’t have assumed he was using FD.

 
Flag Post

RalphSpoon, what I suggest you do is: Add a player, use an array to add the level, check where the player is relative to the array. For example, say you had an array:

[0,0,0,
0,0,0,
X,0,0]

Using this, I will say the player is at (3, 3). If the player jumped, the player should be in a higher position on the array, like maybe at marker Y in the next array, which is at (3, 2).

[0,0,0,
Y,0,0,
0,0,0]

The next step is to make the character move. If the player is blocked by a wall, don’t move that way. Else, move. As the player moves, update the relative position of the player so the player can be blocked if it suddenly hits a wall. Check the array numbers that the player’s relative horizontal/vertical position is a decimal point. For example, if a player is at (3, 2.5), check (4,2) and (4,3). If (4,2) or (4,3) is a wall, the player cannot move right. Else, move right if the player pushes the right arrow key or D or whatever.

Next step: performance. Throughout the game, one must keep performance low. For blocks, keep them as sprites and import a bitmap. For the player, there is something called blitting (block image transfer, I’m not really sure how that works), use that on the player so when the player walks, you get a high-performance walk-cycle. For spikes that move up and down, I would guess you should put them at the back of the display list (but at a higher index than the background, so you can see the spikes in front of the background but behind the blocks)- I suggest when loading a level, you load the spikes first. Finally, add coins. Add the end of a level, add all stats to an array, store the array in a Shared Object, and use the flush(); method. A lot of games figure what coins you picked up; use an array to store what coins you picked up, find a way of numbering the coins on each level (from 1-100?) and store that in a SharedObject too. I don’t code a lot, so I can’t give you anything on how high the performance will be. However, I suggest that, while viewing your SWFs, open task manager and check the SWF’s performance. Most high-performance games are around the 50000-80000K region. I don’t think it should exceed 100000K- it then starts to go a bit laggy on older computers (my computer anyway.)

Sorry if you don’t understand, but I hope it helps. Good luck!

 
Flag Post
Originally posted by RalphSpoon:

@shadow_craver, yes, i’ve done side scroller, shooting, maze games all made in flash as3, and yes im pretty scared to know the fact that those 2 are very hard to do(inventory and shop ) + saving it(shared objects).

attempt it. The worst that can happen is you throw the learning stone a few feet before it falls back down to the ground.
If you see the two games I’ve uploaded so far, they’re an embarrassment. Ones made completely from a tutorial, the other was months and months of headache only to be halted by errors I didn’t understand at the time.
I could fully program it now without fail.
You have to attempt any of your ideas. It will force you to google, download e-books, search your local library, go over tutorials like a mad man, Try youtube at first, but as soon as your able move on to examples and tutorials on places like this, kirupa, ect. Youtube is not the best compendium of as3 examples for the intermediate.

I promise it will be a year, or two, or three before you make something grand. But when you do, I can only imagine tears of pure gold run down thy cheeks the moment of upload. Tears that magically protect you from any criticism, cause your like… idc bitches, I made this. Its my baby.

good luck.