为什么我的应用程序在发布并在Android设备上运行时有所不同?

时间:2017-05-01 10:48:54

标签: actionscript-3

我使用adobe cs5.5构建了一个平台游戏,用as3编写。 当我在电脑上测试我的应用程序时,游戏运行完美,但是当我 发布它并运行到我的Android设备我有一些重力问题。 有时当我降落在地面上时,所有舞台都开始颤抖。 奇怪的是,在相同的地面上有时阶段开始 颤抖,有时不是。 这是我的代码或其他什么问题? 我使用800w x 480h舞台。 我使用GPU模式发布。 我内心的所有地面都是我的形状。

var xvel = 0;
var yvel = 0;
var GRA = 1;
var FRICT = 0.85;

var downarr = new Array(-12,0,12);
var vertarr = new Array(-20,-30);
var uparr = new Array(-3,0,3);

this.addEventListener(Event.ENTER_FRAME,FramesEvents);

function windowcamera()
{
    var newx =  -  savvito.x + 350;
    var distx = newx - bg.x;
    bg.x +=  distx;

    var newy =  -  savvito.y + 370;
    var disty = newy - bg.y;
    bg.y +=  disty;
}

function phys()
{
    savvito.x +=  xvel;
    savvito.y +=  yvel;
    xvel *=  FRICT;
    yvel +=  GRA;
    if (yvel > 8)
    {
        yvel = 8;
    }
    if (yvel > 2)
    {
        onground = false;
    }


    savvito.virtx = savvito.x + bg.x;
    savvito.virty = savvito.y + bg.y;
    downPush(savvito);
    leftPush(savvito);
    rightPush(savvito);
    upPushCloud(savvito);
    upPush(savvito);
}

function runJump()
{
    onground = false;
    yvel =  -  12;
}

function downPush(d)
{
    d.virtx = d.x + bg.x;
    d.virty = d.y + bg.y;
    for (var i = 0; i < uparr.length; i++)
    {
        var num = uparr[i];
        var tx = d.virtx + num;
        var ty = d.virty - 40;
        while (bg.ground.hitTestPoint(tx , ty , true))
        {
            d.virty++;
            ty++;
            d.y++;
            yvel = 1;
        }
        for (var ie=0; ie<boxingArr.length; ie++)
        {
            var e = boxingArr[ie];
            if (e.liftthisbox == 0)
            {
                while (e.hitTestPoint(tx , ty , true))
                {
                    e.y--;
                    e.yvel = 0;
                }
            }
        }
    }
}
function rightPush(d)
{
    d.virtx = d.x + bg.x + xvel;
    d.virty = d.y + bg.y;
    for (var i = 0; i < vertarr.length; i++)
    {
        var num = vertarr[i];
        var tx = d.virtx + 15;
        var ty = d.virty + num;
        while (bg.ground.hitTestPoint(tx , ty , true))
        {
            d.virtx--;
            tx--;
            d.x--;
            xvel = 0;
        }
        for (var ie=0; ie<boxingArr.length; ie++)
        {
            var e = boxingArr[ie];
            if (e.liftthisbox == 0)
            {
                while (e.hitTestPoint(tx , ty , true))
                {
                    d.virtx--;
                    tx--;
                    d.x--;
                    xvel = 0;
                }
            }
        }
    }
}
function leftPush(d)
{
    d.virtx = d.x + bg.x + xvel;
    d.virty = d.y + bg.y;
    for (var i = 0; i < vertarr.length; i++)
    {
        var num = vertarr[i];
        var tx = d.virtx - 15;
        var ty = d.virty + num;
        while (bg.ground.hitTestPoint(tx , ty , true))
        {
            d.virtx++;
            tx++;
            d.x++;
            xvel = 0;
        }
        for (var ie=0; ie<boxingArr.length; ie++)
        {
            var e = boxingArr[ie];
            if (e.liftthisbox == 0)
            {
                while (e.hitTestPoint(tx , ty , true))
                {
                    d.virtx++;
                    tx++;
                    d.x++;
                    xvel = 0;
                }
            }
        }
    }
}
function upPushCloud(d)
{
    if (yvel > 0)
    {
        d.virtx = d.x + bg.x;
        d.virty = d.y + bg.y;
        for (var i = 0; i < downarr.length; i++)
        {
            var num = downarr[i];
            var tx = d.virtx + num;
            var ty = d.virty;
            while (bg.cloudbg.hitTestPoint(tx , ty , true))
            {
                onground = true;
                jdown = false;
                d.virty--;
                ty--;
                d.y--;
                yvel = 0;
            }
        }
    }
}
function upPush(d)
{
    d.virtx = d.x + bg.x;
    d.virty = d.y + bg.y;
    for (var i = 0; i < downarr.length; i++)
    {
        var num = downarr[i];
        var tx = d.virtx + num;
        var ty = d.virty;
        while (bg.ground.hitTestPoint(tx , ty , true))
        {
            onground = true;
            jdown = false;
            d.virty--;
            ty--;
            d.y--;
            yvel = 0;
        }
        for (var ie=0; ie<boxingArr.length; ie++)
        {
            var e = boxingArr[ie];
            while (e.hitTestPoint(tx , ty , true))
            {
                onground = true;
                jdown = false;
                d.virty--;
                ty--;
                d.y--;
                yvel = 0;
            }
        }
    }
}

 function FramesEvents(e:Event)
{
    phys();

    controls();

    windowcamera();
}

0 个答案:

没有答案