Map of ARPG web game (iv)

Source: Internet
Author: User

This section is intended to supplement the previous section, which has been covered in the previous section of the optimization strategy for maps, as described in this section.

    1. Map block Load queue: Take 1280*800 screen resolution, about the need to load the map block between the 30~35 block, if this time load so many map blocks, occupy the network bandwidth will be more, because IE load resources are also limited, if the excess limit will be added to the queuing mechanism. So this time, you need a map load queue, to limit the number of loading map blocks at the same time, such as can be loaded at the same time two, when the two of which loader loaded, this object is recycled, and then back to the next.
    2. Rendering strategy optimization, is actually the distance of the frame operation. That is, no frame loads only one map block, and only a map that has already been downloaded is draw. The code references the previous section.
    3. Before entering the map, the mosaic is displayed first. The code is as follows:
function void         {            if (thumbnaildata = = BMD                )return;             = BMD;            G.clear ();            G.beginbitmapfill (Thumbnaildata, Scalematrix);            G.drawrect (0, 0, ViewPort.maxRect.width, viewPort.maxRect.height);        }

There are two more questions:

    1. Before switching the map, destroy the previously loaded map block and trigger a garbage collection, which effectively reduces memory. The map is destroyed, including the load completed, loading, and the loading is not shown to be destroyed. The policy of the Flash recycling mechanism is that the object has a reference count of 0, and then it is recycled. Trigger Flash to force garbage collection, you need to create an exception, the code is as follows: private
function gcbyexception ():void        {            try            {                new LocalConnection (). Connect ("foo");                 New LocalConnection (). Connect ("foo");              Catch (E:error)            {            }             return;}

2. Implementation of vibration screen (Tweenmax implementation):

 public static function  Shake (Target:displayobject, Distance:int  = ten, Delay:number = 0.5): void   { var  targetx:* = Targe            T.x;             var  targety:* = Target.y;             var  shakedis:* = distance;            Tweenmax.killtweensof (target);  Tweenmax.to (target, delay, {bezierthrough:[{x:targetx, y:targety  + distance}, {x:targetx, y:targety-distance}, {x:targetx, y:targety + Distance/4}, {x:targetx, Y:targety-distance/4},{x:targetx, y:            Targety}]});         return  ; }
About the game push graph basically this content, this project is relatively independent, can be compiled into a separate SWC separately for use.

Map of ARPG web game (iv)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.