原来手机开发就是这样的:
<?xml version="1.0" encoding="UTF-8"?> <widget> <frame-list name="stage" loop="none" > <label id="1" text="Hello Word !" width="100" height="100" fontSize="16"/> <define-image id="101" source="${picture1}" /> <define-image id="102" source="${picture2}" /> <define-image id="103" source="${picture3}" /> <define-image id="104" source="${picture4}" /> <define-image id="105" source="${picture5}" /> <define-image id="106" source="${picture6}" /> <define-image id="111" source="${picture7}" /> <define-image id="112" source="${picture8}" /> <define-button id="2001"> <character-records> <character-record state="1" characterID="111"/> <character-record state="2" characterID="112"/> <character-record state="3" characterID="112"/> </character-records> </define-button> <frameset id="1008" url="ballmove"/> <frame index="1"> <script type="1"><![CDATA[ mainFrm=gearbox.getFrameset(); if time==nil then time=1; locate={ speed=20; x=20; y=20; } end mainFrm:placeObject(0,5,103,"leftBtn",{translateX=0,translateY=300}); mainFrm:placeObject(0,10,104,"rightBtn",{translateX=550,translateY=300}); mainFrm:placeObject(0,111,101,"ball",{translateX=locate.x,translateY=locate.y}); mainFrm:placeObject(0,20,2001,"sureBtn",{translateX=240,translateY=280}); -- 注册按钮的监听事件 mainFrm:getObjectByName("leftBtn"):addEventListener("ONCLICK","clickLeftButtonHander"); mainFrm:getObjectByName("rightBtn"):addEventListener("ONCLICK","clickRightButtonHander"); mainFrm:getObjectByName("sureBtn"):addEventListener("ONCLICK","clickSureButtonHander"); -- 实现按钮监听事件:左移动 function clickLeftButtonHander() locate.speed = -20; end -- 实现按钮监听事件:右移动 function clickRightButtonHander() locate.speed = 20; end -- 实现按钮监听事件:复位 function clickSureButtonHander() --locate.x=int(math.random(10,500)); --locate.y=int(math.random(10,250)); locate.speed=0; end function int(a) return a-a%1; --这种求整方法…… 第一次见 end mainFrm:placeObject(0,30,1008,"ballmove"); ]]></script> </frame> </frame-list> <frame-list name="ballmove" loop="infinite" frameRate="20"> <frame index="1"> <script type="1"><![CDATA[ if locate.x+locate.speed>640 or locate.x+locate.speed<0 then locate.speed= - locate.speed; end locate.x=locate.x+locate.speed; mainFrm:placeObject(1,111,101,"ball",{translateX=locate.x,translateY=locate.y}); ]]></script> </frame> </frame-list> </widget>
话说原来我玩的手机游戏都是这种代码弄出来的,啧啧,也不过如此吧不过 开发游戏最难的还是的算法部分啊…… 数据结构很重要!!!!!!!!!
今天一天就弄了个这乱七八糟的,不过也是一点收获啦……


522

被折叠的 条评论
为什么被折叠?



