A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 52 of 52

Thread: [F8][WIP] Invasion 5

  1. #41
    trashtalkthedollar.com
    Join Date
    Jan 2007
    Location
    Fairfax, VA
    Posts
    188
    i hate to be a douchebag, but wat's supposed to be fun about this?

    the performance is incredible... im really amazed at how you do it, but the game just isnt fun. its really repetitive and dull... and the only unit that becomes any use later in the game is the canoneers

    Quote Originally Posted by Viza
    Use all of renders ideas, and the game could be kickass

  2. #42
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Quote Originally Posted by VENGEANCE MX
    (and it'd go even slower if you worked it out mathematically - ie, writing your own hitTest() - a hundred times slower ).
    Vengeance, i made some tests with math square to square,my way, with the summ of the radius pre calculated and the results were that it was faster then circle to circle without sqrt.I posted the results in a thread called as3 hittest cos at first i was thinking it would work only for as3, but its faster for as2 too.
    But as noone cares about it this is the last time i will talk about it.
    Last edited by Cimmerian; 01-19-2007 at 05:59 AM.

  3. #43
    Half Empty happinessSam's Avatar
    Join Date
    May 2003
    Location
    London
    Posts
    442
    Playing flash games is research... yes... research.

    Hmmm. Actually in it's current form the game doesn't require any micro management. It was a case of buying a load of knight, release all of them at the start, then minimising the window. Do a bit of work, have a look a bit later. The castle would be destroyed and I'd do another level.

  4. #44
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Quote Originally Posted by Cimmerian
    Vengeance, i made some tests with math square to square,my way, with the summ of the radius pre calculated and the results were that it was faster then circle to circle without sqrt.I posted the results in a thread called as3 hittest cos at first i was thinking it would work only for as3, but its faster for as2 too.
    But as noone cares about it this is the last time i will talk about it.
    Even if that's the case, I'm not using circle to circle collision, so it'd still be slower. It doesn't change the fact that it'd still have to do hundreds and hundreds of extra collision checks.

    @johnnyblazedx:
    Currently it's no fun at all (even I'll admit it ) because it's devoid of strategy and challenge (due to a lack of balancing, and no tactical advantage to mixing unit types). Once I've added a few of the ideas presented in this thread (and started balancing everything), it'll start to get a lot more fun. But challenging or not, I still think there's something awe-inspiring about seeing so many people breaking upon a castle, like rocks upon water (LotR quote, I know ).

    @happinessSam:
    If you want micromanagement, I could add it, but the game was never meant to be like that. It was only ever intended to be a role-reversal of Defend Your Castle. Besides, if you micro-managed, you'd be able to move your archers away from the castle's line of fire, or tell your guys to stop walking when the arrows appear. It'd negate the challenge of the game.

    However, I am considering making it so that you could cast spells with your mouse, such as drawing a line above your troops, which would act as a barrier to shelter them from incoming arrows.
    http://www.birchlabs.co.uk/
    You know you want to.

  5. #45
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    ever thought about adding armor upgrades so they don't die in one hit? maybe for a much more expensive cost?
    mmm signature

  6. #46
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Did think of it, yes, but even 1 extra HP will double the survival rate of most units. In one distro of the game, infantry had 2 HP and never lost a match.
    http://www.birchlabs.co.uk/
    You know you want to.

  7. #47
    Junior Member
    Join Date
    Aug 2008
    Posts
    17

    Destructible terrain scrolling

    Hi,

    Just wondering if anybody has any pointers for getting the destructible terrain to scroll as in micro warriors (http://www.birchlabs.co.uk/Micro%20Warriors.swf). As soon as I move the terrain the holes no longer appear in the right places.

    Sebastian

  8. #48
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Posting the code you're using would be a good start.
    http://www.birchlabs.co.uk/
    You know you want to.

  9. #49
    Junior Member
    Join Date
    Aug 2008
    Posts
    17

    destructible terrain code

    Hi. To make this work you need three movieclips: dot, ground and hole. Pretty straightforward, but as soon as I use my scrolling function things get screwed up. The scrolling function is below as well. Thanks so much for the help!!

    //the code

    import flash.display.BitmapData;
    import flash.geom.*

    gravity=3

    var myCT:ColorTransform = new ColorTransform (1, 1, 1, 1, 0, 0, 0, 0);
    var my_mc:MovieClip = this.createEmptyMovieClip ("mc", 1);
    var myBmp:BitmapData = new BitmapData (Stage.width, Stage.height, true, 0x00000000);

    //levelBitmap.draw(ground, m);
    myBmp.draw (ground, myMatrix);

    my_mc.attachBitmap (myBmp, 0, "never", false);
    this.attachMovie ("hole", "hole_mc", 2);
    this.attachMovie ("ground", "ground", 3);
    this.attachMovie ("dot", "dot", 4);
    dot._x=200
    hole_mc._x = -100;
    //make first hole
    var myMatrix:Matrix = new Matrix ();
    myMatrix.translate(ground._x, ground._y)
    myBmp.draw(ground, myMatrix);
    ground.swapDepths(_root.getNextHighestDepth());
    removeMovieClip(ground);

    onMouseDown = function () {
    var myMatrix:Matrix = new Matrix ();
    myMatrix.translate (this._xmouse - hole_mc._width / 2, this._ymouse - hole_mc._height / 2);
    myBmp.draw (hole_mc, myMatrix, myCT, "erase");
    };
    onEnterFrame = function () {
    //get the pixels
    if (myBmp.getPixel (dot._x, dot._y + 1) == 0) {
    dot._y+=gravity;
    }
    };


    //and the scrolling function

    function scrollControll(ob){

    ob._x += (((Stage.width/2)-scrollAdjustHorizontal/3.5-center._x)/10)*friction;

    ob._y += (((Stage.height/2)-scrollAdjustVertical/3.5-center._y)/10)*friction;

    }

    scrollAdjustHorizontal = DistanceBetweenHorizontal(center, crosshair_mc);

    //the center would be the player's character and crosshair_mc is just set to the mouse position. DistanceBetweenHorizontal + vertical just calculates the distance obviously.

    function DistanceBetweenHorizontal(mc1, mc2){
    var dx = mc2._x - mc1._x;
    return(dx);
    }
    function DistanceBetweenVertical(mc1, mc2){
    var dy = mc2._y - mc1._y;
    return(dy);
    }

  10. #50
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    Looks like you need to figure in the mc's x/y location when you do myMatrix.translate.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  11. #51
    Junior Member
    Join Date
    Aug 2008
    Posts
    17

    sollution maybe?

    thanks for the advice! I switched the code around a bit and this seems to work OK. I don't know yet if it'll work with my scroller function though. Thanks again!
    I'm working on a game called ¡Ya Basta! which can be found at http://www.sebazistan.com and comments are appreciated. Basically I want it not to reinvent the side scroller but to do EVERYTHING all the best side scrollers do. Anybody who is curious-- I'm happy to share code.

    replace this in the actionscript above:

    onMouseDown = function () {
    var myMatrix:Matrix = new Matrix ();
    myMatrix.translate (this._xmouse-my_mc._x, this._ymouse-my_mc._y);
    myBmp.draw (hole_mc, myMatrix, myCT, "erase");
    };
    onEnterFrame = function () {
    //get the pixels
    if (myBmp.getPixel (dot._x-my_mc._x, dot._y-my_mc._y + 1) == 0) {
    dot._y+=gravity;
    }
    my_mc._x++
    dot._x++
    };

  12. #52
    Junior Member
    Join Date
    Aug 2008
    Posts
    17

    Yahoo!!!

    Well, this seems to work fine!! Thanks again!

    import flash.display.BitmapData;
    import flash.geom.*

    gravity=3
    friction=.9

    var myCT:ColorTransform = new ColorTransform (1, 1, 1, 1, 0, 0, 0, 0);
    var my_mc:MovieClip = this.createEmptyMovieClip ("mc", 1);
    var myBmp:BitmapData = new BitmapData (Stage.width, Stage.height, true, 0x00000000);

    //levelBitmap.draw(ground, m);
    myBmp.draw (ground, myMatrix);

    my_mc.attachBitmap (myBmp, 0, "never", false);
    this.attachMovie ("hole", "hole_mc", 2);
    this.attachMovie ("ground", "ground", 3);
    this.attachMovie ("dot", "dot", 4);
    this.attachMovie ("dot", "crosshair_mc", 5);
    crosshair_mc._xscale=200

    dot._x=200
    hole_mc._x = -100;
    //make first hole
    var myMatrix:Matrix = new Matrix ();
    myMatrix.translate(ground._x, ground._y)
    myBmp.draw(ground, myMatrix);
    ground.swapDepths(_root.getNextHighestDepth());
    removeMovieClip(ground);

    onMouseDown = function () {
    var myMatrix:Matrix = new Matrix ();
    myMatrix.translate (this._xmouse-my_mc._x, this._ymouse-my_mc._y);
    myBmp.draw (hole_mc, myMatrix, myCT, "erase");
    };
    onEnterFrame = function () {
    //get the pixels
    if (myBmp.getPixel (dot._x-my_mc._x, dot._y-my_mc._y + 1) == 0) {
    dot._y+=gravity;
    }
    crosshair_mc._x=_xmouse
    crosshair_mc._y=_ymouse
    scrollControll(dot);
    scrollControll(my_mc);

    };
    scrollAdjustHorizontal = DistanceBetweenHorizontal(dot, crosshair_mc);
    scrollAdjustVertical = DistanceBetweenVertical(dot, crosshair_mc);

    function DistanceBetweenHorizontal(mc1, mc2){
    var dx = mc2._x - mc1._x;
    return(dx);
    }
    function DistanceBetweenVertical(mc1, mc2){
    var dy = mc2._y - mc1._y;
    return(dy);
    }

    //and the scrolling function
    function scrollControll(ob){
    ob._x += (((Stage.width/2)-scrollAdjustHorizontal/3.5-crosshair_mc._x)/10)*friction;
    ob._y += (((Stage.height/2)-scrollAdjustVertical/3.5-crosshair_mc._y)/10)*friction;
    }

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