我已经在iPad和Android的corona sdk中完成了一个项目,其中有四个主要模块,还有一个模块也有一些子模块.用于改变我使用导演类的场景.虽然我遵循了每一种内存管理技术,但我的项目在15分钟内退出,有没有解决方案?提前感谢...
我目前正在使用Corona SDK制作塔防游戏.然而,当我正在制作游戏场景时,背景场景总是覆盖怪物产卵,我已经尝试过background:toBack(),但它不起作用.这是我的代码:
module(..., package.seeall)
function new()
local localGroup = display.newGroup();
local level=require(data.levelSelected);
local currentDes = 1;
monsters_list = display.newGroup()
--The background
local bg = display.newImage ("image/levels/1/bg.png");
bg.x = _W/2;bg.y = _H/2;
bg:toBack();
--generate the monsters
function spawn_monster(kind)
local monster=require("monsters."..kind);
newMonster=monster.new()
--read the spawn(starting point) in level, and spawn the monster there
newMonster.x=level.route[1][1];newMonster.y=level.route[1][2];
monsters_list:insert(newMonster);
localGroup:insert(monsters_list);
return monsters_list;
end
function move(monster,x,y)
-- Using pythagoras to calauate the moving distace, Hence calauate the time consumed according to speed
transition.to(monster,{time=math.sqrt(math.abs(monster.x-x)^2+math.abs(monster.y-y)^2)/(monster.speed/30),x=x, y=y, onComplete=newDes}) …Run Code Online (Sandbox Code Playgroud) 我猜它非常自我解释,我需要知道在物理引擎启用时是否可以禁用/阻止对象的旋转.物体受重力影响,因为它在大部分时间内都会下降.
例如,如果我想要一个隐形框,如果它的alpha值为0,我怎么能得到触摸事件呢?或者是否有另一种制作隐形盒子的方法.
local function invisiblebuttontouch(event)
if event.phase == 'began' then
print (event.x..","..event.y)
end
end
button = display.newRect(1,1,300,300)
button:addEventListener("touch",invisiblebuttontouch)
button.alpha = 0
Run Code Online (Sandbox Code Playgroud)
它永远不会打印出x和y,但是如果我没有将alpha设置为0,那么它可以正常工作.
只有在多个语句为假时才有办法执行一行代码吗?
我有一个库存:
inventory = {
{"Images/Category 1/pistol1.png", false},
{"Images/Category 1/machinePistol1.png", false},
{"Images/Category 2/shotgun1.png", false},
{"Images/Category 2/assaultRifle1.png", false},
{"Images/Category 3/sniperRifle1.png", false},
{"Images/Category 3/rocketLauncher1.png", false}
}
Run Code Online (Sandbox Code Playgroud)
我想编写一个函数来执行一行代码,如果所有这些语句都是假的,但如果其中一个是真的,显然会执行其他的操作.
我希望有一个触发器可以在事件发生时停止计算得分,
function restartStopScore()
score = score + 0
end
Run Code Online (Sandbox Code Playgroud)
不管用
score = 0
local scoreText = display.newText( "Score: " .. score, 20, 20,nil, 40)
scoreText:setTextColor(255,255,255)
local function getScore() -- increments Speed value every time it is called
score = score + 1
scoreText.text = "Score: " .. score
print("score" .. score)
end
timer.performWithDelay(1000, getScore, 0)
function restartScore()
--reset the score
score = 0
end
timer.performWithDelay(5000, restartScore, 1)--test trigger reset the score
Run Code Online (Sandbox Code Playgroud) 我在创建移动应用程序时使用以下config.lua文件.
构建到设备时,屏幕将无法调整到iPhone5.但是,它会在电晕提供的模拟器上运行时进行调整.
你能告诉我问题是在这个文件中,还是在于它取决于其他一些实现问题.
谢谢!
/ S
local isTall = ( "iPhone" == system.getInfo( "model" ) ) and ( display.pixelHeight > 960 )
-- iPad Configuration
if ( string.sub( system.getInfo("model"), 1, 4 ) == "iPad" ) then
application =
{
content =
{
width = 360,
height = 480,
scale = "letterBox",
xAlign = "center",
yAlign = "center",
imageSuffix =
{
["@2x"] = 1.5,
["@4x"] = 3.0,
},
},
}
-- iPhone5 Configuration
elseif ( string.sub( system.getInfo("model"), 1, 2 ) == …Run Code Online (Sandbox Code Playgroud) 我没有找到一个可以使PNG图片的透明区域没有被触摸的变量.DisplayObject是否具有可以使透明区域无法触及的功能或变量?
感谢您的回答.
我是Corona和Lua的新手.我有以下问题:
我有一个cake带有这些物理参数的对象(并不重要):
["cake1"] = {
{
pe_fixture_id = "", density = 2, friction = 0, bounce = 0,
filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 },
shape = { -21, 62.5 , -36, 62.5 , -50, 55.5 , -58.5, 46 , -36, -38.5 , 57, -40.5 , 57.5, 34 }
}
,
{
pe_fixture_id = "", density = 2, friction = 0, bounce = 0,
filter = { categoryBits = 1, maskBits = …Run Code Online (Sandbox Code Playgroud) 我们尝试购买 - 使用测试帐户的真实产品,我们没有使用其中一个Android测试ID.谷歌弹出框似乎正常,我们正常输入密码,并得到"这是一个测试购买,你不会被收取等"的消息.当我们按下确定时,应用程序崩溃并停止响应.
我们认为这次崩溃可能已经发生,因为我们的build.settings文件中有错误的googlePlayGamesAppId,因此我们修复了该问题并再次尝试.
但是现在如果我们尝试调用store.loadProducts,我们会收到以下错误:
错误刷新库存(查询自有项目).(回复:-1003:购买签名验证失败)
我们查看了这个错误,我看到的每个链接都说有人试图使用android.test.purchased进行测试购买,我们没有这样做.
我们已经在我们的其他两个应用程序中使用了store.consumePurchase({transaction.productIdentifier})几个月,这两个应用程序使用的是我们现在用来处理所有商店功能的完全相同的lua文件.但是,我们似乎无法再调用consumePurchase(因为商店中没有任何购买失败)因此我们无法使用违规商品.
我们尝试了4个不同的用户帐户,都遇到了同样的问题.
当我们尝试进行首次购买时,这是输出:
D/IabHelper(20893): Starting async operation: refresh inventory
D/dchan (20893): Inventory refresh successful. (response: 0:OK)
D/IabHelper(20893): Querying owned items, item type: inapp
D/IabHelper(20893): Package name: com.my.game
D/IabHelper(20893): Calling getPurchases with continuation token: null
D/Finsky (17292): [798] InAppBillingUtils.getPreferredAccount: com.my.game: Account from first account - [hz0AOjMW0S_KNSX3z-B9OZxAwkE]
D/Finsky (17292): [798] InAppBillingUtils.getPreferredAccount: com.my.game: Account from first account - [hz0AOjMW0S_KNSX3z-B9OZxAwkE]
D/IabHelper(20893): Owned items response: 0
E/IABUtil/Security(20893): Signature verification failed.
W/IabHelper(20893): In-app billing warning: Purchase signature verification **FAILED**. …Run Code Online (Sandbox Code Playgroud) coronasdk ×10
lua ×7
alpha ×1
android ×1
events ×1
game-physics ×1
google-play ×1
iphone-5 ×1
scripting ×1