Page 18 of 21 FirstFirst ... 81617181920 ... LastLast
Results 256 to 270 of 306

Thread: The basics of an RPG (role-playing game)

  1. #256

    RPG

    Also, its nothing much but here is what im still working on. I just put it together, so it doesnt have the building command yet. Ive been working on it for school. Oh...well since its 800kb (lol) heres the .swf. Well this sucks. My files are to big...so ill post it on my website in a bit. lol sorry about this.

  2. #257

  3. #258
    What is confusing?

  4. #259
    shotmenot's Avatar
    197
    posts
    Stealth Ninja Productions
    i need someones help, do you know if this rpg will work on MX, because i made my movie on 2004 and im having trouble getting it to work on MX

  5. #260
    shotmenot's Avatar
    197
    posts
    Stealth Ninja Productions
    i also have another question for you guys, i made it so if you press space it swings the sword. all of the action script is right but it starts playing wehn you press space, but your guy must keep moving to keep the sword keep swinging


    gar i know what is wrong i just dont know how to fix it... the action script that keeps the guy from moving constantly is keeping the sword from swinging on its own... is there any way to fix it with out changing him not moving constantly... hope you understand that
    Last edited by shotmenot; April 21st, 2005 at 06:59 AM.

  6. #261
    Quote Originally Posted by shotmenot
    i also have another question for you guys, i made it so if you press space it swings the sword. all of the action script is right but it starts playing wehn you press space, but your guy must keep moving to keep the sword keep swinging


    gar i know what is wrong i just dont know how to fix it... the action script that keeps the guy from moving constantly is keeping the sword from swinging on its own... is there any way to fix it with out changing him not moving constantly... hope you understand that
    Hmm... Without looking at your code, I can't say for sure... though I did do something like that before - I had animation for the guy moving, and sword animation seperate...
    I beleive I had one MC with 2 Layers. On layer 1 was an MC which had the Guy's Sprite. That MC had 2 Frames - Stationary, and an Animated MC of the guy moving. The other layer had an MC of the sword with two animations: Stationary/Moving.

    My code would then call each embedded MC depending on the key-pressed.... like... (and my code is not even going to be close to right)

    Code:
    if (arrowkey is pressed) {
    _root.guy_mc.move_mc.gotoandplay('walking');
    } else {
    _root.guy_mc.move_mc.gotoandplay('stopped');
    }
    
    if (attackKey is pressed) {
     _root.guy_mc.sword_mc.gotoandplay('swinging');
     } else {
     _root.guy_mc.sword_mc.gotoandplay('stopped');
     }
    Also, I think I had some attachMovie code set up for my sword_mc that would allow you to switch weapons. Play with it, I know I'm not giving you exact answers, but (hopefully) you should be able to figure it out.

  7. #262
    shotmenot's Avatar
    197
    posts
    Stealth Ninja Productions
    the scripting i have is here... the sword and the guy are on the same layer and movie clip.. like it works with the swinging you just have to move the guy because the action script that says if no keys are press stop is blocking the animation


    Code:
    onClipEvent (load) {
    walkSpeed = 6;
    stop();
    }
    onClipEvent (enterFrame) {
     
     function checkCoords(x,y,direct){
      guyTL = _root["tile_"+Math.floor((x-(_parent._width/2)+1)/_root.tileWdth)+"_"+Math.floor((y-(_parent._height/2)+1)/_root.tileHght)].barrier;
            guyTR = _root["tile_"+Math.floor((x+(_parent._width/2)-1)/_root.tileWdth)+"_"+Math.floor((y-(_parent._height/2)+1)/_root.tileHght)].barrier;
        guyBR = _root["tile_"+Math.floor((x+(_parent._width/2)-1)/_root.tileWdth)+"_"+Math.floor((y+(_parent._height/2)-1)/_root.tileHght)].barrier;
       guyBL = _root["tile_"+Math.floor((x-(_parent._width/2)+1)/_root.tileWdth)+"_"+Math.floor((y+(_parent._height/2)-1)/_root.tileHght)].barrier;
    switch(direct) {
     case 0:
     if (guyTL || guyTR) {
      return false;
     }
     case 1:
     if (guyBR || guyBL) {
      return false;
     }
     case 2:
     if (guyTR || guyBR) {
      return false;
     }
     case 3:
     if (guyTL || guyBL) {
      return false;
     }
    }
    return true;
     }
     
     
     
     
     if (Key.isDown(Key.UP)) { 
     play();
     _rotation = 180;
     
     if (checkCoords(_parent._x, _parent._y - walkSpeed,0)){
     
     _parent._y-= walkSpeed;
     }}
     
     if (Key.isDown(key.RIGHT)) {
      play();
      _rotation = 270;
      if (checkCoords(_parent._x + walkSpeed, _parent._y,2)){
      
      
      _parent._x+= walkSpeed;
     }
     
     }
     if (Key.isDown(key.LEFT)) {
      play();
      _rotation = 90;
      if (checkCoords(_parent._x - walkSpeed, _parent._y,3)){
      
      
      _parent._x-= walkSpeed;
     }}
     if (Key.isDown(key.DOWN)) {
       play();
      _rotation = 0;
       if (checkCoords(_parent._x, _parent._y + walkSpeed,1)){
        
      
      _parent._y+= walkSpeed;
       }
     }
     if (!Key.isDown(key.UP) & !Key.isDown(key.DOWN) & !Key.isDown(key.LEFT) & !Key.isDown(key.RIGHT)) {
      stop();
     }
     
     var name ="tile_"+Math.floor((_parent._x / _root.tileWdth))+"_"+(Math.floor(( _parent._y /_root.tileHght)));
    if (_root[name].isDoor) {
     _root.changeMap(_root[name].toMap,_root[name].guyX,_root[name].guyY);
    } else {
     _root.justMoved = false;
     }}
     on(keyPress"<space>"){
      
      gotoAndPlay("guy", 7); 
    }

  8. #263
    Quote Originally Posted by shotmenot
    the sword and the guy are on the same layer and movie clip.. <space>
    You need to split them up. Make one MC that's of the sword not moving. Another of it moving, a 3rd MC of the guy not moving, and a 4th of the guy Moving.</space> Lets (hypothetically) name the first "swordStill", then "swordMove", then "guyStill", and "guyMove".

    Next, make another MC called: "sword_mc", and make 2 frames. In frame one, place "swordStill", and put the code "stop();".
    In frame 2, put "swordMove", and again put "stop();"
    Next, make a 6th MC, and name it "guy_mc", again, put 2 frames in it. Frame one should have the "guyStill", and frame 2 should have "guyMove", both with"stop();" as the code. Now, make one more MC, and name it "Guy", and make 2 layers. On one layer, place "sword_mc", and the other place "guy_mc". (doesn't matter which layer).

    Now, your code to play the attack animation would look something like this:
    Code:
    _root.Guy.sword_mc.gotoAndStop(2);
    and to end the animation say:
    Code:
    _root.Guy.sword_mc.gotoAndStop(1);
    For movement, you would say:
    Code:
    _root.Guy.guy_mc.gotoAndStop(2);
    and to stop moving you would say:
    Code:
    _root.Guy.guy_mc.gotoAndStop(1);
    This makes it so that both moving, and attacking would be completely independent of each other, so that if one stops, the other won't, and vice versa.
    <space> </space>

  9. #264
    So how do i make it online? Am i able to make it so other people will be able to see other people?

  10. #265
    shotmenot's Avatar
    197
    posts
    Stealth Ninja Productions
    one quick question at you SeiferTim how hard is it to alter your map maker tool to help me make maps.... the doing them hand way is getting old fast :\

  11. #266
    shotmenot's Avatar
    197
    posts
    Stealth Ninja Productions
    is it really difficult to program a monster in the rpg? one that will like follow you at first, then attack with random damage?

  12. #267
    Not really.. there are several ways to do it. The easiest way is just to make an enemy which is constantly attracted to the player... and moves like 5 steps towards the player every interval... and then when it hits the player, it deals damage, and explodes/dies/whatever... but if it hits the player's weapon, it dies without dealing damage. Use a lot of randoms, and hittests Marz's tutorials on AI are a great help, too.

  13. #268
    ok, how can I make it so that if the person runs into the borders of the page(550, 400) the person wont go any further. Like a constraint in the startDrag() function, please help!?!?!?

  14. #269
    with the
    Code:
    if(Key.isDown(Key.RIGHT)){
    _x++;
    }
    put in
    Code:
    if(Key.isDown(Key.RIGHT) && _x<Stage.width){
    is checks the X position is smaller than the stages width

    do it like that for all of them

    and the left would be
    Code:
    if(Key.isDown(Key.LEFT) && _x>0){

  15. #270
    TheCanadian's Avatar
    10,305
    posts
    Noo doot aboot it, eh?
    Quote Originally Posted by cobrasniper555
    ok, how can I make it so that if the person runs into the borders of the page(550, 400) the person wont go any further. Like a constraint in the startDrag() function, please help!?!?!?
    I'm sure that what nathan said works perfectlt for you and that you don't use startDrag() to move your character. But if you did, read this:
    startDrag()

    Usage

    startDrag(target:Object,[lock:Boolean, left:Number, top:Number, right:Number, bottom:Number]) : Void

    Parameters

    target The target path of the movie clip to drag.

    lock A Boolean value specifying whether the draggable movie clip is locked to the center of the mouse position (true) or locked to the point where the user first clicked the movie clip (false). This parameter is optional.

    left, top, right, bottom Values relative to the coordinates of the movie clipís parent that specify a constraint rectangle for the movie clip. These parameters are optional.
    Proud Montanadian
    We tolerate living and breathing. And niches.

    Name Brand Watches

    Maybe getTimer() or TweenMax is the answer to your problem . . .

Page 18 of 21 FirstFirst ... 81617181920 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012