Results 1 to 7 of 7
  1. #1

    Default help, in flash programming, exploding pixel map.


    im making this one, its an exploding pixel map, but it seems so slow.... my frame rate is now up to 50 fps..

    guys, whats seems to be the problem.

    http://www.binaryideas.net/clients/_roy/360media/final_prototype3.swf

    http://www.binaryideas.net/clients/_...a/explode3.zip



  2. #2

    Default Re: help, in flash programming

    help, its my script is so slow, anyone got a tip?
    or any site that has a script similar to this...

    thanks in advance.

  3. #3

    Default Re: help, in flash programming, exploding pixel map.

    kuan bai. basin daghan na kaau kag movies within movies mao hinay na kaau..

    kai recursive man pag update ana... mas lesser ang prio for updating sa mga movies within movies.. mao na akong na bantayan..


    also gi unsa nimo pag traverse imong array map?. nya gi unsa nimo pag query nga kana nga pixel mo update og location.

    suwayi gamit time base modeling bai. or kong naai threading ang flash gamita na..

    gi unsa ni nimo pag himo imong map?. ingon ani.

    xxxxxxdxxxxxxdxxxxxxdxxxxxxdxxxxdx
    xxxxxddxxxxxxxxdxxxxxxxxxdxxxxdxxx
    xxxxxxdddxxxxxdxxxxxxdxxxxxxdxxxxd
    xxxxxxdddddxxdxxxxxxdxxxxxxdxxxxdx

    where d = visible pixel. x = imaginary space..

  4. #4

    Default Re: help, in flash programming, exploding pixel map.

    bai just read some of your codes and how you implimented it.
    ang akong ma sulti hinya jud siya hehe even tried it on a 3gbp4 dual core 1.5gbram hinya jud.

    Code:
    function proximity() {
    	var x:Number = _root._xmouse;
    	var y:Number = _root._ymouse;
    	var cx:Number = this._x;
    	var cy:Number = this._y;
    	var prox:Number = Math.sqrt((x-cx)*(x-cx)+(y-cy)*(y-cy));  
    	//prox = Math.ceil(prox);
    	//trace(prox);
    	//trace (flag)
    	if (prox<=10) {
    		hit = true;
    	} else {
    		hit = false;
    	}
    }
    onEnterFrame = function () {
    	proximity();
    	if (init == undefined) {
    		//get initial position
    		initx = this._x;
    		inity = this._y;
    		init = true;
    		//position added to reposition if the mouse is hovered on this object
    		ndy = y00+random(20);
    		ndy = Math.round(ndy);
    		ndx = x00+random(20);
    		ndx = Math.round(ndx);
    	}
    	//var hit = this.hitTest(_parent._xmouse, _parent._ymouse, true);   
    	if (hit eq true) {
    		this._x += (this.dx-this._x)/6;
    		this._y += (this.dy-this._y)/7;
    		this.dx = ndx;
    		this.dy = ndy;
    	} else {
    		this._x += (this.dx-this._x)/6;
    		this._y += (this.dy-this._y)/6;
    		if (Math.round(this._y) == this.ndy) {
    			this.dx = initx;
    			this.dy = inity;
    			
    			var x:Number = _root._xmouse;
    			var y:Number = _root._ymouse;
    			var cx:Number = this._x;
    			var cy:Number = this._y;
    			var xprox:Number = Math.sqrt((x-cx));
    			var yprox:Number = Math.sqrt((y-cy));
    			
    			if (int(xprox)> 0 and int(xprox)<10) {
    				//trace ("right");
    				ndx = x00+random(30);
    				ndx = Math.round(ndx);
    			} else if (int(xprox)==0) {
    				//trace ("left");
    				ndx = x00-random(30);
    				ndx = Math.round(ndx);
    			}
    			
    			if (int(yprox)> 0 and int(yprox)<10) {
    				ndy = y00+random(20);
    				ndy = Math.round(ndy);
    			} else if (int(xprox)==0) {
    				//trace ("left");
    				ndy = y00-random(20);
    				ndy = Math.round(ndy);
    			}
    		}
    	}
    };

    mao ni akong comments..

    proximity();
    cirular collision mani sakto?. sqrt functions takes so much time on cpu bai. you can use other functions nga mo detect og collision with
    lesser cpu cycles. ithink its best to use square collision detection kai square bitaw imong objects.



    if you still need circular collision bai u convert this vb function to fit your need..
    xoffset1 = objectwidth/2
    yoffset1 = objectheight/2
    Code:
    ' Collision detection
    Public Function CircleCD(x1 As Single, y1 As Single, xOffset1 As Single, yOffset1 As Single, Radius1 As Single, x2 As Single, y2 As Single, xOffset2 As Single, yOffset2 As Single, Radius2 As Single) As Boolean
    
      Dim DeltaX As Single
      Dim DeltaY As Single
      Dim CD As Single
      Dim SumRadii As Single
      
      DeltaX = (x2 + xOffset2) - (x1 + xOffset1)
      DeltaY = (y2 + yOffset2) - (y1 + yOffset1)
      
      CD = (DeltaX * DeltaX) + (DeltaY * DeltaY)
      
      SumRadii = Radius1 + Radius2
        
      If (CD <= (SumRadii * SumRadii)) Then
        CircleCD = True
      Else
        CircleCD = False
      End If
    
    End Function

    basta avoid squareroot functions.. kai hinay kaau na.

    as for the updating of x,y bai.. its best to use time based modeling.
    kai tanaw nako sa imong script sigi man gud siya og update x,y nya di ra kaau ma notice ang movements. kai gagmay kaau og move or something

    diri ma gamit nimo ang timebase modeling..
    like if an object moves 5 pixels per second... then imo ra siya i update ang location sa pixel every 1second.. and not every time ma agi-an siya. (or dependi kanosa nimo gusto.. kong every 500ms raba or onsa).. mao rana akong ma suggest..

    also bai if you can cache the variable i cache jud na kai you can save preciouse cpu cycles.
    ex:
    if(x-y)
    if(x-y)
    if(x-y != yy*yx)
    if(x-y && yy*yx)

    mas better if:
    z = x-y
    zz = yy*yx
    if(z)
    if(z)
    if(z!=zz)
    if(z&&zz)

  5. #5

    Default Re: help, in flash programming, exploding pixel map.

    nice effect.
    i'm not a flash math genius, so i can't help. sorry.

  6. #6

    Default Re: help, in flash programming, exploding pixel map.

    kuyawa ato bai oink... mao ratoy output sa kataas sa codes?... grabeh... paeta... hehe


    bilib na jud ko nimo bai silent-kill... matinabangon nga genius... hehehe... bitaw :mrgreen:


    yeah! bling bling men...abz'

  7. #7

    Default Re: help, in flash programming, exploding pixel map.

    Thanks sa tips..

  8.    Advertisement

Similar Threads

 
  1. need help in flashing emaxx 785 bios
    By cdcrobbie in forum Computer Hardware
    Replies: 9
    Last Post: 06-27-2010, 11:13 PM
  2. need help in java programming: creating a folder
    By rastaman81 in forum Programming
    Replies: 4
    Last Post: 03-11-2009, 08:51 AM
  3. help in flashing samsung p300
    By cobwebbie in forum Gizmos & Gadgets (Old)
    Replies: 0
    Last Post: 09-30-2008, 01:14 AM
  4. Help in choosing 5 Mega pixels digicam
    By buloi123 in forum Gizmos & Gadgets (Old)
    Replies: 48
    Last Post: 12-18-2005, 10:00 AM
  5. Replies: 2
    Last Post: 09-14-2005, 08:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top