A Flash Developer Resource Site

Page 1 of 14 1234511 ... LastLast
Results 1 to 20 of 261

Thread: [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [

  1. #1
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Guys, it was while we had a broad discution about game theory and flashrules sugested a RPG based tutorial. What I was thinking is to open this post so we can share our expirience with this type of games, post samples, codes, and talk in general...in my exaples I will use strictly top-down view with pseudo isometric elements.
    This is what I was thinking to begin with:

    1. how to move your hero ----> 4,8 directions or full freedom..
    2. how to set the world map --> this will focus mainly how to set walkable vs non-walkable "tiles". how to change the screens like in Zelda.
    3. how to set the interface ---> life metter, money, score, bonus points, invetory, how to use items from the invetory, pick things and drop things in different screens.
    4. Battle design - > turn based vs free form fight , simple chase algorithms ( non-AI ), may be we can say few words for AI in general..

    Do you think that we should include something else ?

    I already have few examples flas wich will be uploaded. Also anyone who wants to post their veiw is more than welcome. Optimisation will be the main issue..
    And last this topic would be almost theoretical like "know how" rather than creating full blown game...

    mad_Sci

    PS my next post will cover - moving the hero arround with a sample fla..

  2. #2
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Ok walkin arround:

    1. create an arrow pointing 3 o'clock.
    2. convert to MC
    3. Goto Actions and paste this code;

    Code:
    onClipEvent (load) {speed = 5;}
    onClipEvent (enterFrame) {
    	if (Key.isDown(Key.UP)) {
    		this._yscale = 100;
    		xx = math.cos(_rotation*Math.PI/180)*speed;
    		yy = math.sin(_rotation*Math.PI/180)*speed;
    		this._x += xx;
    		this._y += yy;
    	}
    	if (Key.isDown(Key.LEFT) ) {
    		this._rotation -= 45;
    		
    	} else if (Key.isDown(Key.RIGHT) ) {
    		
    		this._rotation += 45;
    	}
    }
    note the following lines:

    this._rotation -= 45;
    this._rotation += 45;


    now if you change this to 90 you will have 4 direction of movement, if you change it to 45 you will have 8 directions of move. If you go to about 10 you will have full freedom of move. You can put what ever vallues you want, like 180 you will have 2 movemets only left and right..360 only one..

    You can create your hero, top-down view and this MC will have 2 frames..one hero is standing still, frame 2 hero walking. You can download the fla here:

    http://savco.virtualave.net/rpg/walk.fla

    you will se that I put onClipEvent (keyUP) plus a variable
    Key_down. This variable prevents the constant rotation of the hero when you hold down the left or right mouse button..

    mad_Sci


  3. #3
    F# A# oo Ian424's Avatar
    Join Date
    Jun 2001
    Posts
    1,070
    nice start mad sci !

    i was wondering about the 8 way movement, wouldnt this way make the character spin around really fast ?

    just a thought (dont take it the wrong way, your tutorials are great)

  4. #4
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    The answer is Yes it will spin fast..the point is when you walk you would like to change the direction fast, or for example when you are in battle. If you want to slow it down you can use simple loop as a counter..
    like:

    start=this.rotation;
    for ( i= start;i<=start+45;i++)
    this._rotation=i;

    Ian424 all questions are welcome also any improvements or different ideas.actually Im hoping to get some help here.

    mad_Sci


  5. #5
    F# A# oo Ian424's Avatar
    Join Date
    Jun 2001
    Posts
    1,070
    well, im thinking for a secret of mana / zelda-ish movement, that is 8 directional, you'd want different frames for each direction.

    any theories on how to test for up right, down left, etc?
    could you just put

    Code:
    if (Key.isDown(Key.UP) and (Key.isDown(Key.Left)) {
      this._x += speed;
      this._y -= speed;
    }
    ?

    or just check if both are down, and go to a frame, since it would probably move that way anyway. i'll try working out a basic movement thing along this idea, if it'd help someone.


    ** Edit **

    just saw the link to the fla, and i saw how it worked more, so the above idea wouldnt be too useful, unless its looking at a different angle slightly.
    [Edited by Ian424 on 10-07-2001 at 12:36 AM]

  6. #6
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    Very nice start, will you also be discussing possible ways of attaching text messages to NPC characters to help move the story? Oh, and this may be in your plans but will the tile based map be generated on the fly or pre-rendared. I was thinking if you eventually want to create a map editor to go with the RPG it may be better to start this tutorial with having the scenes rendered "on the fly" by being loaded from an external text file ... if you have seen that new flash game book, "Flash game studio," they usually start talking about a game by looking at the map editor first then how to implement it into the game itself. I have a few experiments of tile based map editors I use for my games that I wouldn't mind contributing to the discussion. Well, that's my 2 cents!

  7. #7
    F# A# oo Ian424's Avatar
    Join Date
    Jun 2001
    Posts
    1,070
    i'd think doing text for npc characters wouldnt be too bad, just load the text into a variable, and then display a movie clip that is a window, with scrolling and stuff, displaying the variable.

  8. #8
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Actually No we wont be using a game engine..one reason for that is that we wont to limit the number of MC on the stage to a minimum so we can use larger scripts. Here is what I have in mind:

    When you build the world you use basicaly 2 types of tiles:
    A) walkable
    B) non-walkable tiles

    now if we take the above example ( fla ) and create a layer below the hero and import a PNG file like grass..we can use this a walkable tile. The layer above the walkable and below the hero will contain the non-walkable elements..this layer will contain on big MC. This big MC will have 25 keyframes with a stop action above them. Each Key frame will have a lablel A-Z just one letter. Each Key frame will represent different screen. Ok now you can click this big MC and edit on place so you see the whole stage and start designing the non-walkable tiles like bushesh etc.etc..move to keyframe 2 and design again...
    Also is a good idea to put on a paper a basic grid so you get the idea how to link different scenes.

    to be continued...

    mad_sci

  9. #9
    Senior Member
    Join Date
    Jan 2001
    Posts
    361
    Your always on the ball mad-sci, good start

  10. #10
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    How you doin Hackey

    OK here I set a basic grid:

    http://savco.virtualave.net/rpg/rpg.jpg

    each letter represents the name of one keyframe. The red rectangle are doors or exits from one cell to another. Note that Z cell is a bit off we will be using this to jump to another scnete or lets call it another spot in the world. So you will have 26 rooms per scene. if you have 10 scenes this will give you 260 different places to explore..quite a bit a ?

    Did you guys get my idea so far ?

  11. #11
    Senior Member
    Join Date
    Jan 2001
    Posts
    361
    Hey Mad-Sci im doin pretty good, and i get the drift so far!

  12. #12
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    Its a great idea Mad-Sci, I see what you are doing with this...


  13. #13
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Ok so far so good. Next step is to position the exits. Those will be 4 invisible rectangular MC. Each screen will have a different position of the exits. For example:

    Key frame A: will have only 2 exits Right and Down.
    Key frame B: will have only 2 exits Left and Right..

    Each of the exits will run a hitTest with the hero and return one variable, wich will be like:

    go_left=1 or go_right=1 etc..etc..

    OK now in the main time line in frame 1 we will put a look up table:

    row1="abcde";
    row2="fghig";
    row3="klmno";
    row4="pqrst";
    row5="uvwxyz";

    In the hero MC we can use a simple script to change the screen:
    go_right ==1 --> get the current row and coll ( the coll will be a substring of the row ) and increase the coll by one.

    so if our current position is:

    row1:A and we move right because we have exit we get the next substring wich is B. so we use gotoAndStop("b") to change the screen. In key frame B we have exit to the left towards A..

    Ok so far ?

  14. #14
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    UPDATE: while I was setting up the example fla. I realize that there is no need of putting MC for the exits rather then using a simple warp. What I mean is that in each room the hero will be restricted by the walls at let say at x=500. If you have an exit you can walk tru it and your X will be 520 so you can warp it like:

    if ( this._x >=510){ this._x=30;}
    and the oposite.
    here is an exaple fla wich changes only 2 rooms from A to B and backwords. Also I pasted some green circles different for each room. Those are supposed to be bushes..

    http://savco.virtualave.net/rpg/walk2.fla

    So up to now we have only 2 MC at the stage and non of which is activly playing. the movie runs fast even at 12 fps but you can change this to 30 fps for even better result.

    I will stop here for now so you can get use to the idea and if you have any questions about the script..
    the main actions are in hero MC.

    mad_Sci


  15. #15
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    This is interesting, I came up with the idea of making a Zelda type RPG engine a few months ago, and I did it kind of how you are making yours. The only problem I ran into was making the IA follow the guy without walking through the trees ... will you be making the game have real time combat like Zelda, or turn based like final fantasy?

    p.s. if anyone is interested in seeing my old engine go here: http://www.iliketodream.8m.com/ztest.html


  16. #16
    incredibulus-actionscriptum magnetos's Avatar
    Join Date
    May 2001
    Posts
    2,160
    hey mad-sci
    cool work
    i always wondered how the heck those japanese people make
    rpg like zelda


    i was wondering how come you know so much about flash gaming?
    are you working for macromedia??
    do you eat micromedia's books for lunch?

    how about creating a complete rpg game??
    with you knowledge and the other guys'help we could make

    the first actual flash cool game!!

    well that's it now i go sleep


    CIao zzzzzzzzzzzzzzzzzz
    mag.............











  17. #17
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Ha ha ha ha magnetos I take this as compliment..in fact Im a doctor. I grew with computers I got one when I was 10 it was the good ol Sinclair ZX Spectrum. About the Flash Gaming believe it or not but I learned it here at FlashKit.

    mad_sci

    PS about the full scale game unfortunatly I dont that ammount of free time but Im sure that you and guys here can do it..

  18. #18
    Member
    Join Date
    May 2001
    Posts
    93
    Wow....I go away for the weekend...and BOOM a huge amount of progress...I'm gonna put this to go work and post hmm I guess you'd call them add-ons for this tutorial...instead of one MC...being rotated I have some code i'm gonna put in that'll allow for 8 point 8 differing view style movement...but my word this is an INCREDIBLE tutorial!
    Keep it up!
    A doctor?! GEEZ...I feel so pathetic this is the field I'm trying to go into and ur doing this as a hobby!? ACK...oh well hopefully my music minor will pay off.
    heh
    -B

  19. #19
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I have a question about movement code.

    Why do you need this line?
    this._yscale = 100;

    You are not changing yscale anywhere else, so why would you need to set it again to 100?

    Sorry, if this is stupid question

  20. #20
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Actually you are right. There is no need for it..you can delete or ignore it..it is a rudiment.

    mad_sci

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center