A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [F8] Fancy hants code

  1. #1
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259

    [F8] Fancy hants code

    If you don't feel like reading my jargon just read the underlined text.

    Hello all it's been a long time since I've posted any thing. Anyway I thank you for looking at my qustion. I'll get right to the matter. I'm building a game that I believe will be better than one of the greatest flash games to ever grace the internets, "Fancy Pants". What I have to ask is what frame rate do you all believe this game is running at ? Also I've been on the AS scene for some time now but, I think I could use some pointers on how to improve the speed of my code. Fancy Pants must have move code than my Alpha, why do you think his game run so fast?

    my game:
    Mr. White
    my game runs @ 30 fps

    Fancy Pants:
    Fancy link
    CEO OF

  2. #2
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    Lots of quick scrolling like that, without scaling and rotating - probably means they're using cacheAsBitmap.

  3. #3
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259

    thank you for the reply

    I read about cacheAsBitmap and I understand what it does. Thank you lesli_felix I never used cacheAsBitmap and I think that this may be the answer. do you think that fancy pants used this method? I'll repost the Alpha with the cacheAsBitmap method.
    CEO OF

  4. #4
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    It thinks its very likely. Moving large vector graphics around is much faster with cacheAsBitmap, provided they don't contain any animation, and don't get rotated or scaled. Basically, you can only move them around the stage, otherwise they get recached every frame which slows things down a lot.

  5. #5
    Wait- what now? tidenburg's Avatar
    Join Date
    Dec 2005
    Posts
    1,471
    Really nice game, I hope it does well One thing, if it is to compete with fancy pants, the character needs to be more agile and swift.

    p.s. Hate to throw a spanner in the works but your fotter breaks FK's footer rules:
    http://board.flashkit.com/board/showthread.php?t=710156
    Last edited by tidenburg; 11-24-2006 at 01:18 PM.
    "I'd only told them the truth. Was that so selfish? Our integrity sells for so little, but it is all we really have. It is the very last inch of us, but within that inch, we are free."

  6. #6
    Please, Call Me Bob trogdor458's Avatar
    Join Date
    Aug 2006
    Location
    Pensacola, FL
    Posts
    915
    fancy pants link doesnt work for me, but i like the animation you have for your "Mr. White" game, thats all i can say since your link is broken, ill google it though

    idk man, fancy pants is a pretty good game, do you think you'll be able to compare?
    http://www.fancypantsadventures.com/
    Last edited by trogdor458; 11-24-2006 at 01:28 PM.

  7. #7
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259

    sorry

    sorry about the link i added too many http:// in the address. Fancy Pants. thanks for the comments but as of now Mr. White can't come close to Fancy right now. You asked can I really make a game better than Fancy, well I feel like we all need to go for the stars and if we land in the clouds were still a lot higher than a lot of people and now were closer to the stars than we were before. I'm only a one man team, I make every thing from the ground up and I know fancy was build with a team. If I can out do them than I will know I'm a great programer.
    Last edited by zervell; 11-24-2006 at 09:48 PM.
    CEO OF

  8. #8
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259
    I tryed what you told me and I've tryed to revamp my code I put a demo pack together and I'm hopping some one can tell me why my game lags so much. I put a txt file with the code in it, F8 ,MX fla, and a swf. Please take a look thank you.

    download

    in the code file

    Code:
    /* 
    level black engine (ver 2.1) 
    Demo
    
    *****************************************************
    
    by zervell:
    Waarith Abdul-Majeed
    Suger Cookie Games
    2004-2006
    
    *****************************************************
    */
    
    stop();
    var dx_speed:Number = 10;
    var rkeyup:Boolean;
    var lkeyup:Boolean;
    var delta_x:Number = 0;
    var delta_xm:Number = 0;
    var gravity:Number = 0;
    var dubjump:Boolean = false;
    var offground:Boolean = false;
    var jumping:Boolean = false;
    var up_notpressed:Boolean = true;
    var dub:Boolean = true;
    hero.cacheAsBitmap = true;
    land.cacheAsBitmap = true;
    /* 
    ver 1.0 onEnterFrame()
    */
    function onEnterFrame() {
    	void camera_plat();
    	void movementx();
    	void movementy();
    	void movementstop();
    }
    /* 
    ver 2.0 Movementx()
    */
    function movementx() {
    	var friction:Number = .5;
    	hero._x += delta_xm;
    	delta_xm = Math.round(delta_x);
    	if (Key.isDown(Key.RIGHT)) {
    		hero._xscale = 100;
    		delta_x += 2;
    		rkeyup = false;
    	} else {
    		rkeyup = true;
    	}
    	if (Key.isDown(Key.LEFT)) {
    		hero._xscale = -100;
    		delta_x -= 2;
    		lkeyup = false;
    	} else {
    		lkeyup = true;
    	}
    	(delta_x>dx_speed) ? delta_x=dx_speed : 0;
    	(delta_x<-dx_speed) ? delta_x=-dx_speed : 0;
    	(delta_xm>0) ? delta_x -= friction : 0;
    	(delta_xm<0) ? delta_x += friction : 0;
    	return;
    }
    /*
    ver 2.5  movementy()
    */
    function movementy() {
    	hero._y += gravity;
    	if (!land.hitTest(hero._x, hero._y, true)) {
    		gravity += 1;
    		offground = true;
    	}
    	if (Key.isDown(Key.UP)) {
    		if (!offground) {
    			hero._y -= 5;
    			gravity = -15;
    			jumping = true;
    			up_notpressed = false;
    		}
    	} else {
    		up_notpressed = true;
    	}
    	if (Key.isDown(Key.UP) && jumping && up_notpressed && !dub) {
    		gravity = -15;
    		dub = true;
    	}
    	if (gravity>=15) {
    		gravity = 15;
    	}
    	return;
    }
    /*
    ver 2.5  movementstop()
    */
    function movementstop() {
    	//x movement control
    	while (land.hitTest(hero._x+16, hero._y-20, true)) {
    		hero._x -= 1;
    		delta_x = 0;
    	}
    	while (land.hitTest(hero._x-16, hero._y-20, true)) {
    		hero._x += 1;
    		delta_x = 0;
    	}
    	//y movement control
    	if (land.hitTest(hero._x, hero._y-40, true)) {
    		hero._y += 5;
    		gravity = 5;
    	}
    	while (land.hitTest(hero._x, hero._y, true)) {
    		gravity = 4;
    		hero._y -= 1;
    		dub = false;
    		offground = false;
    		jumping = false;
    	}
    	return;
    }
    /*
    ver 2.9 camera_plat
    */
    function camera_plat() {
    	//y control
    	var camera_y:Number;
    	camera_y = Math.round(((hero._y-20)-(Stage.height/2))/5);
    	hero._y -= camera_y;
    	land._y -= camera_y;
    	(camera_y>10) ? camera_y=10 : (camera_y<-10) ? camera_y=-10 : 0;
    	abs_delta_xm = Math.abs(delta_xm);
    	//y control
    	hero._x -= Math.round(((hero._x)-(Stage.width/2))/10);
    	land._x -= Math.round(((hero._x)-(Stage.width/2))/10);
    }
    CEO OF

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