corona

remove all spawned coins

浪子不回头ぞ 提交于 2019-12-11 18:15:48
问题 What is the best way to remove all spawned coins when the game is over? Here is the code that spawns the coins: screenGroup = self.view coin = {} coinspawn = function() i = display.newSprite( imageSheet1, sequenceData1 ) i.x = display.contentWidth i.y = math.random(0, display.contentHeight-50) i:play() i.collided = true i.name = "coin" physics.addBody(i, "dynamic", {density=.1, bounce=0.1, friction=.2, shape= shape2 ,filter=playerCollisionFilter } ) --player.gravityScale = 0.5 coinIntro =

Corona error: attempt to call global “startButtonListeners” <a nil value>

倾然丶 夕夏残阳落幕 提交于 2019-12-11 16:37:45
问题 I'm making a main menu scene in corona, however I've come across an error and its driving me crazy. The compiler makes it confusing for me to understand what it is but I can point out 2 problems from it: attempt to call global "startButtonListeners" [C] in function "startButtonListeners" Here is the section of code: function scene:enterScene(event) local group = self.view startButtonListeners('add') function startButtonListeners(action) if(action == 'add') then aboutBtn:addEventListener('tap'

Corona Simulator stop working after connecting to server

北城以北 提交于 2019-12-11 14:27:36
问题 I have 2 server file work with corona simulator. One is work but another isn't. Not sure what is the different between these 2 file. Below is my server code. Non-working: class Chat(Protocol): def connectionMade(self): self.factory.clients.append(self) def connectionLost(self, reason): self.factory.clients.remove(self) def dataReceived(self,data): for c in self.factory.clients: c.message(data) print data def message(self, data): self.transport.write(data) factory = Factory() factory.clients =

Finding free space in square to spawn enemy

江枫思渺然 提交于 2019-12-11 13:30:23
问题 I have an area where the enemy needs to be spawned to look good (they are behind a fence) and I don't want the enemies to spawn over each other so I was wondering if there is any good way to do this? http://sv.tinypic.com/r/2zowwu1/8 I created a function that check if the next box (the next enemy) fits in all possible positions (pixel by pixel) but this is to slow as it is a mobile application and the enemies can be spawned rather fast sometimes. Sure there must be a nice formula that can

Issue with Priority when objects overlap

南楼画角 提交于 2019-12-11 11:42:36
问题 I have 2 object Object1 and Object2 When I use transition.to(Object1,{time=1000,x=Object2.x,y = Object2.y}) Object1 will be above Object2. If I want Object2 to be above Object1, how can I do? Thanks for all answers! 回答1: You can use object:toFront to move Object2 to front. Something like this: Object2:toFront() Note: this not only moves Object2 in front of Object1 but in front of all other siblings. If you want more control about displaying you need to built it yourself :) 来源: https:/

Verifying assets with the App Store in Application Loader

梦想的初衷 提交于 2019-12-11 10:34:33
问题 I am trying to submit my app to the app store using Application Loader , but the submitting process stuck at Verifying assets with the App Store. I have been trying to submit my app for two days and and it still stuck there. I know that maybe a common issue , but I tried the solutions written in the other question but nothing worked with me :/ my app is built using corona sdk , does anyone have an idea ? :/ 回答1: I have the same problem and in my case it seems to be related to the LAN network

How to hide native.newTextField after clicking submit?

夙愿已清 提交于 2019-12-11 08:04:32
问题 I'm trying trying to have users name fade in one letter at a time vertically. Example: Adam "A" would appear after 1 second , "d" would appear after 3 seconds under the displayed A, "a" would appear after 5 seconds under the displayed d, "m" would appear after 7 seconds under the displayed a. The visuals would have a sort of domino effect.When they appear they would stay displayed on screen. When if I comment out userNameField:removeSelf () then the code works fine. I get the effect I want,

how to call function between 2 .lua

情到浓时终转凉″ 提交于 2019-12-11 07:48:46
问题 this is how i call a function from menu.lua at main.lua local menu = require("menu") menu.drawMenu() but how i gonna call a function from main.lua at menu.lua ? is it possible ? or set a listener or something like that 回答1: If you are simply looking to provide actions for the menu, would it not be better to use a set of call back functions (as used when building GUI elements) to be triggered when menu items are clicked? This link may help you. http://www.troubleshooters.com/codecorn/lua

Is there any way to make Android SDK's device emulator to emulate an ARMv7 device?

妖精的绣舞 提交于 2019-12-11 04:36:01
问题 By default AVD runs ARMv6, is there any way to make it emulate an ARMv7 device? 回答1: There is the ability to download an "ARM EABI v7a System Image" via the 'SDK Manager tool' (this is in the 4.2 API product tree). Then you will need to create an emulator, that uses this system image. If the image you are looking for doesn't exist (you aren't seeing it in the list of downloadable options in the SDK Manager) it probably isn't possible right now. Bottom line, you will need the ARMv7 system

Permission issues in lua

荒凉一梦 提交于 2019-12-11 04:09:03
问题 Is it required to set some specific permissions in corona build.settings to save high score in file permanently? I'm getting and error every time I run the code saying "Permission denied" How to rectify this error? Here is the code I tried: function read_score() local f1 = assert(io.open(path, "r+")) local contents = f1:read( "*a" ) highScore = tonumber(contents) if highScore==nil then highScore=0 elseif score>highScore then highScore=score end f1:write(highScore) f1:close() disp_permScore()