corona

Transition in Corona SDK

青春壹個敷衍的年華 提交于 2019-12-06 03:33:20
How to give transition for changing color in corona sdk. I have tried like this, but it's not working transition.to (show_text, {time=1000,color="rgb(0,0,0)"}); The following trick works. Unfortunately it doesn't allow for very sophisticated color manipulations without using multiple transitions: local function modify(text) local mt = { r = 0, g = 0, b = 0, __index = function(t, k) if k == "r" or k == "g" or k == "b" then return getmetatable(t)[k] end end, __newindex = function(t, k, v) getmetatable(t)[k] = v if k == "r" or k == "g" or k == "b" then t:setTextColor(math.round(t.r or 0), math

Add 'fake' antialiasing to rotated rectangle

一笑奈何 提交于 2019-12-05 21:16:33
I'm using Corona SDK, which fairly recently disabled antialiasing, without a way to re-enable it. I have several apps that use rotated rectangles and lines, and would like a way for to not look jagged. This image shows the difference: Is there a way to add some sort of antialiasing to these rectangles in Corona? I'd much prefer an antialias hack and be able to use new Corona features and fixes than use an old build with antialiasing.] Thanks! You can use masks to your rects or images, it can minimize aliasing and it's a good alternative in anti-aliasing I test the rect without a mask, it's

xCode device logs not populating after application crash

白昼怎懂夜的黑 提交于 2019-12-05 19:02:28
I'm getting a crash on my iPad 2 when building my Corona SDK app with a distribution profile, and putting it on my device via a USB cable. I'm testing a bug that happens when the internet is not connected (not sure if relevant). When the app crashes, the devices window's output stream states that it's storing a crash report ( http://pastebin.com/Qa3BeaJ2 ), but then the crash never shows up when I push the "view device logs" button. When I push that button, I get an error message. Is resolving this the secret to getting my crashes to show up in the device logs? Jul 28 13:41:17 JackSpicer crash

sqlite - how do I get a one row result back? (luaSQLite3)

陌路散爱 提交于 2019-12-05 18:25:45
How can I get a single row result (e.g. in form of a table/array) back from a sql statement. Using Lua Sqlite (LuaSQLite3). For example this one: SELECT * FROM sqlite_master WHERE name ='myTable'; So far I note: using "nrows"/"rows" it gives an iterator back using "exec" it doesn't seem to give a result back(?) Specific questions are then: Q1 - How to get a single row (say first row) result back? Q2 - How to get row count? (e.g. num_rows_returned = db:XXXX(sql)) Here is a demo of getting the returned count: > require "lsqlite3" > db = sqlite3.open":memory:" > db:exec "create table foo (x,y,z);

Object assignment Lua

喜夏-厌秋 提交于 2019-12-05 02:01:36
I have a problem similar to this one: LUA and Corona error: Attempt To Call Method ' ' (A Nil Value) - Driving Me Crazy I have a TCell class: local TCell={}; local cell_mt = { __index=TCell }; function TCell.new(_contents_name,_x,_y) ... local ncell= { ... }; function ncell:setup() ... end ncell:setup(); return setmetatable(ncell,cell_mt); end return TCell; I have 2d array of TCell references called cells. When I assign cells[ind1][ind2]=cells[ind3][ind4] cells[ind1][ind2] begins to lose some properties. If I understood the link above correctly it's caused by losing the metatable association.

Update database version in Lua

旧时模样 提交于 2019-12-04 17:24:50
I'm trying to update the database version but, I'm facing a strange problem... Here's my code: version = 2 local cur_db_version=nil for data in db:nrows("PRAGMA user_version") do cur_db_version=data break end local db_version=cur_db_version.user_version print(db_version) print(version) if (db_version~=version) then create() db:exec("PRAGMA user_version="..version) end Imagining that the database version is 1 , I'm expecting that my script prints this: 1 2 But what it is printing is: 2 2 Why? I don't know but, I do know that if I comment the line db:exec("PRAGMA user_version="..version) , then

middleclass problems

﹥>﹥吖頭↗ 提交于 2019-12-04 13:16:22
I'm using the LUA middleclass library now after some problems and I have a situation that I can't seem to figure out. Say I have my class: EDIT: Had a typo: here is the actual functions require "middleclass" weaponCanon2 = class("weaponCanon2") function weaponCanon2:onWeaponCollision(event) if (event.phase == "began") then if (event.other.name ~= "ground") then self.canonBall.inAir = false end end end function weaponCanon2:initialize(atX, atY, inGroup) self.name = "some value" self.someObject:addEventListener("touch", **weaponCanon2.onWeaponCollision**) ... end When I do this, every variable

CoronaSDK - Implementing game timer counting milliseconds

两盒软妹~` 提交于 2019-12-04 06:25:46
问题 I am using timer.performWithDelay to time how long it takes a player to complete a level. I want it to measure down to the 100th of a second (because the game is multiplayer, and I don't want there to be too many ties). Here is what I did: local totaltime = 0 local function counter() totaltime = totaltime + 0.01 print(totaltime) end timer1 = timer.performWithDelay( 10, counter, 0) It results in each "second" lasting about 4 seconds. Is this just not practical or is there a flaw somewhere? 回答1

Nancy (C#): How do I get my post data?

我们两清 提交于 2019-12-03 22:23:45
I'm using Corona SDK to post data to my C# server: headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept-Language"] = "en-US" local body = "color=red&size=small" local params = {} params.headers = headers params.body = body network.request( host .. "/UpdateHand", "POST", nwListener, params ) I receive a message on the server: Post["/UpdateHand"] = x => { Console.WriteLine("Received ..."); return "Ok"; }; But when I check the data (when I put a breakpoint on it) I don't see where my data is locaded (i.e. the params.body or params.headers). How can I extract this

corona sdk application size is too big

浪尽此生 提交于 2019-12-03 17:01:32
I'm using corona sdk of anscamobile for developing my new mobile game. I was using the trial edition and when I build my demo of game, I noticed that the app size is too big. (around 25 mb) but it was just containing 2 song (4 mb) and a few very small pngs. What do you think about the source of this size problem? Could it be caused by the programming logic, algorithm or something else? like looping something forever, or using lots of glpbal variables etc.. ? Then if you have some opinions, how can I overcome? thanks. Variables and code take up almost no space. It's more likely to be either