ballFrame

    原来手机开发就是这样的:

<?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>

话说原来我玩的手机游戏都是这种代码弄出来的,啧啧,也不过如此吧

不过 开发游戏最难的还是的算法部分啊…… 数据结构很重要!!!!!!!!!



今天一天就弄了个这乱七八糟的,不过也是一点收获啦……  生气

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值