corona

Background infinite using corona sdk

十年热恋 提交于 2019-12-19 11:34:53
问题 I'm trying to scroll side a background in corona sdk (infinity background) I used two images repeated (854x176). I tried this function: function mov(self, event) if self.x < -854 then self.x = 854 else self.x = self.x - self.speed end end it's working just fine but the problem that a small white space occurred between repetitions. Is there a better way to do this? 回答1: One way of doing this would be to take advantage of Graphics 2.0 Engine's feature called repeating fills. Here are the steps:

How to add custom font in Corona for Android?

杀马特。学长 韩版系。学妹 提交于 2019-12-18 09:14:32
问题 I just tried everthing on the forums but I couldn't add my custom font to system. Here's what I have done: I made sure that family name and font name are same with Typelight program. Then I just change the name of the file in the root directory and drag it to Outlaw. After that write the filename in display.newText. Can you tell me where I am doing wrong? [EDIT] Well, the problem was that I haven't installed the font with Windows Font Viewer. After installing it with WFV and removing the

Forward define a function in Lua?

百般思念 提交于 2019-12-18 04:31:14
问题 How do I call a function that needs to be called from above its creation? I read something about forward declarations, but Google isn't being helpful in this case. What is the correct syntax for this? 回答1: Lua is a dynamic language and functions are just a kind of value that can be called with the () operator. So you don't really need to forward declare the function so much as make sure that the variable in scope when you call it is the variable you think it is. This is not an issue at all

SQLite : Insert text with single quote got from a SQL request

六月ゝ 毕业季﹏ 提交于 2019-12-14 04:12:32
问题 I have already check all the forums about this issue and I found a solution for my first insert, I used the "double quoted" instead a single quote as follow: insertGiftShop(2,"photo02","Modern City by night photo", "item-grumdy1l", "A view of Modern City''s skytrain",1,100, "","no","items",0) The previous function is inserting my row at the beginning of the game. When I check the database, the value is stored like this : " A view of Modern City's skytrain ". It works very well! Now I'm trying

addEventListener() in Lua

淺唱寂寞╮ 提交于 2019-12-14 03:57:17
问题 I have a problem when work with Corona and need a help. When I register an event listener, such as object:addEventListener("touch", listener) . But listener function has many parameters like this: function listener (event, param1, param2...) ... end My question is that how to pass all of parameters to listener. All search only pass one para is event. Thanks! 回答1: local function listener(param1, param2) return function(event) print(event.name, event.phase, param1, param2) end end Runtime

How to retrieve data from CK Editor in corona sdk?

十年热恋 提交于 2019-12-14 03:35:11
问题 I have embedded the CK Editor in a html page. Now I am not able to access the data's that are typed in the CK Editor's text area in my lua code. Is there any way to retrieve the data in corona ? 回答1: You cant do this directly as Corona Webview has limited methods. However, you can make an HTTP call and separate the data yourself (is that editor data comes with the call). I have done this to other website to get currency prices. You can see below how I make a call to moneymex website and then

Developing spring action in corona

亡梦爱人 提交于 2019-12-14 03:25:36
问题 I am trying to develop a spring which has its one end attached to a static roof and the other end has a body with mass m attached to it. Whenever I drag the load(body attached to spring) the spring must also get displaced from its mean position and must behave like a real spring, after few oscillations it must come back to initial position. Now I have developed a spring using a few rectangles which are joined using a pivot joint, a load is also attached using the pivot joint. Here when I drag

LUA and Corona error: Attempt To Call Method ' ' (A Nil Value) - Driving Me Crazy

扶醉桌前 提交于 2019-12-13 13:05:23
问题 I would ask your help for an error that is driving me crazy. Ohh... I'm using LUA with Corona SDK btw... I am creating an instance of a ship. The ship is being instantiated, I can access its properties, but I can not access any method!! Follow the codes, I do not know what to do: spaceShip.lua: require('gameConf') spaceShip = {} spaceShip.__index = spaceShip function spaceShip:New(posX, posY, width, height) local _spaceShip = nil _spaceShip = {} setmetatable(_spaceShip, spaceShip) _spaceShip

How to give priority to button

蓝咒 提交于 2019-12-13 08:04:53
问题 I have 2 buttons, one of which is on top of another. Screenshot: http://prntscr.com/akc6f7 (2 buttons) Basically, when I click on smaller button in the corner ("?"), I also click on the bigger. How can I make sure that I only click "?" button? Also, those buttons are newImageRect() . 回答1: Touch events will fire on the outer most UI element first. Add return true to the end of "?" button touch event to signal that the touch has been handled by the code. Without the return true , the touch

How to make buttons stay pressed using corona

喜夏-厌秋 提交于 2019-12-13 07:47:09
问题 I am trying to get my buttons to stay "pressed" once it is released. Right now I am using the improved Buttons Module for corona and I have the default image being the button looking unpressed, and the over image being replaced by an image that looks pressed. What I am trying to do is once the button is pressed, it stays on the over image. Here is how my code is set up for the button I am testing it on. local digButton = buttons.newButton{ default = "digButton.png", over = "digButtonPressed