dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 26

Thread: Slow Running Game With Flash MX

  1. #1
    Senior Member
    Join Date
    Dec 2005
    Posts
    426

    Slow Running Game With Flash MX

    I have a game you can view here www.ownagestudios.com on my site that runs slow sometimes when you shoot and sometimes when enemys apear. Or just because. Im no flash guines yet so I am wondering How could i speed it up?

    I am using scenes for different sections of my game ex.
    Scenes:
    Preloader
    Intro
    Instructions
    Survival Mode

    etc.

    I dont know if that would be slowing it down.

    Thx in advance for all the help

  2. #2
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Howdy, well one thing that comes to mind is that your using scenes. Using scenes usually increases the file size. You could try either loading seperate swf files or having it all on the same timeline.

    How exactly are the bad guys and bullets coming onto the stage?

  3. #3
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    Thx for replying so fast.

    The enemys, healthpacks, jetpack fire, bullets are all creaed using duplicate movieclip. I can give you the actual code when im out of school.

  4. #4
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Instead you should try attachMovieClip.

  5. #5
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    would that really fix the problem?

    how do i use it, I tryed once but the code did not work. Does the movie clip you are attaching have to be off the stage? and how do i do that and still be able to edit its code at the same time?

  6. #6
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    It will help a bit, I'd also change the scenes thing too.

    Attach movie deals with things that are in the library. And you have to link it. In the library right-click the a movieclip/symbol and select linkage. After that inside of the pop-up box select the first check box, and then in the Identifier text area type in a name for that symbol. That will be the name that you'll use in the code. heres an ex.

    _root.attachMovie("linkageName", "new name", this.getNextHighestDepth());

    I'd input variables in with the newName, so for bad guys you can multiple guys. It would kinda look like this:

    dpie = "piePiece"+currentDegree //where piPiece is he name + a number(currentDegree)
    _root.attachMovie("pie", dpie, currentDegree+10);//it attachs pie a clip in the library
    // and calls it dpie with the level as a number+10 same as getNextHighestDepth().

  7. #7
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    how do i make actionsciprt work on frames for an object?

  8. #8
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Do you mean like on the frame itself on the main timeline or in the objects timeline? Well if it's in the main timeline then anytime you refer to something you use "_root.and the instance name of the object", you get the instance name from the propretise inspector. If it's inside a movieclip, anytime you refer to the object that your inside you use "this.whatever action your doing", if you refer to something that is outside of the object you use _root, and if it's inside the object like another movieclip you just use the movieclip name.

  9. #9
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    ok i have tryed everything to get the flame to move. i have used a for loop on another object on the main frame. then i have tried putting it on the frame instide it and it does not work.
    is there a way to make duplicate object not lag so much

  10. #10
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Could you possible post the code your using

  11. #11
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    ok i will when i get home from school

  12. #12
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    on this is on an object called flamecontroll

    Code:
    if (_root.jetpack == true) {
    		if (timetocreate<=0) {
    			i++;
    			timetocreate = timetocreateholder;
    			newname = "flame"+i*100;
    			_root.attachMovie("jetpack_flame", newname,i);
    			i++;
    			timetocreate = timetocreateholder;
    			newname = "flame"+i*100;
    		}
    	}
    this is on a mc instance named flame and linked jetpack_flame this is on the first frame inside the flame mc
    Code:
    this.load = function()
    {
    	this._x = _root.hero._x-10;
    loadedvars=true;
    	this._y = _root.hero._y+20;
    	
    	xmove = 0;
    	ymove = 0;
    	timetokill = 10;
    };
    this.enterFrame = fucntion()
    {
    	xmove += random(3)*.3;
    	xmove -= random(3)*.3;
    	ymove += random(3)*.3;
    	this._x += xmove;
    	this._y += ymove;
    	timetokill --;
    	if (timetokill <= 0)
    	{
    		this.removeMovieClip();
    	}};

  13. #13
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    why does duplicating lag so much

  14. #14
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Code:
    if (_root.jetpack == true) {
    		if (timetocreate<=0) {
    			i++;
    			timetocreate = timetocreateholder;
    			newname = "flame"+i*100;
    			_root.attachMovie("jetpack_flame", newname,i);
    			i++;
    			timetocreate = timetocreateholder;
    			newname = "flame"+i*100;
    		}
    	}
    I'm not sure if it would have anything to do with it, but why is i, timetocreate=timetocreateholder and newname="flame"+1*100 in there twice? Just an idea, cause it looks right to me other than that.

  15. #15
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    is there a way to speed up my game without using attachmovie clip?

    if you look at my game:
    www.ownagestudios.com/stickmanwars.php

    you can see that it lags around 90 kills

  16. #16
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Are you removing the movie clips after you shot them/kill them?

  17. #17
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    yes i am,
    on every object that goes away
    Code:
    this.removieMovieClip();

  18. #18
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Hmm, I'm wondering if there is something that is running in the background.

  19. #19
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    i dont know i think i might have fixed it but now it freeks out. but i know whats wrong so i will fix that when i get home.

    But does
    unloadMovie(this);
    do anything?

  20. #20
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    I see, hopefully that does it. As for the unloadMovie thing. It's mainly used if you load a swf/jpg into a movieclip on the stage. It works just like removeMovieClip();

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