FAQ Database Discussion Community


Corona sdk not view random text

text,random,lua,corona
I'm have a problem because when I touch my button sometimes my text doe not appear and I do not understand what is wrong. Code: function randomText(event) display.remove(mmDis) local a = {"Cristiano ronaldo jest najlepszy!", "messi jest dobry!","lewandowski jest ok","diego lopez to bramkarz realu"} com = (a[math.random(1,#a)]) local mmDis =...

Variable delay time in timer.performWithDelay

timer,lua,corona
I need to call a function with a variable delay in Corona SDK. I am trying to create a function which will execute a chunk of code which checks to see if the timer.performWithDelay function should keep looping, and cuts it off if the conditions are right. That code is...

storyboard.removeScene(“scene name”) is not working

android,gridview,lua,corona
I am new to corona sdk and trying to build sample in it. i want to get back to main screen automatically after some time by destroying my scene(i mean that scene destroys itself after some particular time and user get back to main screen).I know that for some this...

Corona sdk audio not playing

lua,corona
I have been trying to test out some stuff in Corona sdk because I want to make a math game that will have levels of math for children up to adults. Here is the code I have (It is just a test) Main.lua: display.setStatusBar(display.HiddenStatusBar) local ButtonClickedSound = audio.loadSound( "Button Clicked...

MYSQL PHP triggered by Android (Corona sdk) makes trouble about row/column

php,android,mysql,variables,corona
This is my simple "give-android-my-data-script": $email = $_POST["email"]; $column = $_POST["column"]; $data = $_POST["data"]; mysql_query( "UPDATE members SET '$column' = '$data' WHERE email = '$email'") or die( "database query failed!" ); echo "data retrieved" . $email . $column . $data; Everything is working fine IF but if I change '$column'...

Moving an object using the accelerometer with Corona SDK

lua,corona
I am working on a small personal project to get comfortable with Corona SDK, I created a static floor and two static walls, then I create a ball and added dynamic physics to it. I made a function that moves the ball around when the accelerometer is active but I...

Not printing the proper value

lua,corona
I'm trying to do some string.find magic between data out off a XML file and check1/2/3 but when i print(""..input) it prints Feb 12 20:38:39.410: check1 and not jan check1 = 'jan' check2 = 'kevin' check3 = 'rob' inputNumber = 1 input = 'check' .. inputNumber print(""..input) inputNumber = inputNumber...

Lua stack on iOS device only has ?, and not class names or line numbers

ios,lua,corona,stack-trace,testflight
I'm debugging an app made in Corona on an iOS device. We've passed our app out for testing via test flight around the office, and given our testers a little xCode tutorial, so they can give us the device log when a bug happens. But now, when they send us...

create multiple buttons from table in lua ( Corona sdk )

arrays,table,button,lua,corona
I have a table which looks like this: table = { { id = 1, name = 'john', png = 'john.png', descr = "..." }, { id = 2, name = 'sam', png = "sam.png", descr = "..." } ... } What function could I use to display each picture...

How to use table listeners in corona sdk and how it works?

lua,corona
can any one explain to me table listeners ? how to use it? when and why? and explain to me the following code local object = display.newImage( "ball.png" ) object.id = "ball object" local function onObjectTouch( self, event ) if event.phase == "began" then print( "Touch event began on: "...

Corona sdk random text

text,random,sdk,corona
I`m have a problem because when i touch my button sometimes not appear my text... (Sorry for my English!) Code: function randomText(event) display.remove(mmDis) local a = {"Cristiano ronaldo jest najlepszy!","messi jest dobry!","lewandowski jest ok","diego lopez to bramkarz realu"} com = (a[math.random(1,#a)]) local mmDis = display.newText(tostring(com), display.contentWidth*0.57, display.contentHeight*0.7, display.contentWidth*0.9, display.contentHeight*0.8, "Impact",...

Corona sdk : Play sound when main object hits an obstacle

audio,corona,playsound
I want to play a specific sound when a ball hits a specific object (transparent obstacle) or passes through a specific area. function onCollision(event) if event.phase == "began" then storyboard.gotoScene("restart", "fade", 400) end` end `ball = display.newImage("ball.png") --main object code ball.x = 100; ball.y = 100 physics.addBody(ball, "dynamic", {density=.05, bounce=0.1,...

Corona sdk : stop audio when another starts / launch audio just once

audio,corona
I want to stop a sound when another starts playing . if (event.object1.myName == "obst3") then audio.play(colsound) I want this one to stop if the following one starts . if (event.object1.myName == "t") then audio.play(explosion) Also, I need to know how to launch the sound just once ( when my...

Replacing String in String Corona SDK

string,sdk,lua,corona,lua-patterns
Problem: I have a string like such: "this is a !a joke !/a! haha" The problem is that I want to replace the part "!a joke !/a!" However, the problem is that I cannot use string.replace() since the part between "!a and !/a!" changes so sometimes it may be "!a...

How do I simplify to load some files in the corona?

lua,corona,corona-storyboard
I am new to corona, all the work is from a scratch of others. Let see, I have 3 images that entitled shop1price shop2price shop3price. Now I want it to be simplified as the code below local options = { { defaultFile = 'images/shop1price.png' }, { defaultFile = 'images/shop2price.png' },...

How do I show an in app purchase price in local currency

corona
Just wondering what I need to call to show the price in local currency of my in app purchase. Eg, in Australia I would like to have a button / label that shows $1.29 (tier 1) but if somebody in North America is using the app, it will show $0.99...

tableView onRowRender sluggish with images

lua,corona
So I am not sure if I am doing all wrong, please correct me if that's the case by telling me where I should place the code exactly. I am adding 3 images on every row (display.newImage). It's working very well. The only issue is the scrolling is not fluid....

Global variables have nil value, attempt to call global (a nil value) in Corona

lua,corona,global,nil,value
I attempt to get data (in a global variable) from user through a textbox from the user in functions, and use these variables to insert into a sqlite table. But, when I attempt to do so, I get an error like "attempt to call global locationGlobal (a nil value)" in...

EventListener firing for every image subscribed instead of just the one?

lua,corona
I am dynamically creating images and assigning them an event listener, when I tap the image the event for all images fire, instead of just the one I tapped. I would expect it just to fire the once so where have I gone wrong? math.randomseed(os.time()) for i = 1,20 do...

Lua search through table

lua,corona,lua-table
I am working on a game project using Corona SDK and I am running into an issue. I am trying to use string.find() in a for loop to test to determine if a value is in a certain table and if so, add that value to another table. My problem...

How do i compensate the accelerometer by 90 degrees corona using Lua

android,lua,corona
I am making my game in landscapeRight mode, but i cant get the accelerometer calibrated as landscape because by default in corona the accelerometer is always configured in portrait As the corona guide says http://docs.coronalabs.com/api/event/accelerometer/xGravity.html "So, if your application is running in landscape mode, you'll need to compensate by 90...

Corona : score keep running/ save it and show it after

corona,scoring
My score doesn't stop when my main object hits an obstacle (keeps running on the storyboard restart and start screen). I want it to stop and be able to save it and show it to the gamer next time (even share it on facebook if it's possible ). an image...

lua function not returning data

mobile,lua,corona
I am having trouble with a Lua function. I can set the return value for sendAction to a string ("test") and it will return properly. However I can't get the variable of "data" to return as it always returns nil. What am i doing wrong? local json = require("json"); local...

Black circles instead of images in Corona

android,image,corona
I'm new to Corona and coding in general, and am currently playing around with app reskinning. I am attempting to add my own images to a game, and at this point I am getting black circles instead of my chosen images, while everything else in the game seems to be...

How to insert rows into TableView in Corona?

lua,corona
I'm trying to render the match results (string.find) in to a Row, with kinda works... but its only displaying the last match. so if I match 'jan' and 'kevin' it will; only list 'kevin' Is there a way to fix this ? code: local MasterData = xml:loadFile( "sample.xml") local XMLdataTEST...

How to move and rotate an image at the same time in Corona?

lua,corona
I am trying to throw throwing stars in a game. I can move the star with bulletTransition[bulletCounter] = transition.to(bullets[bulletCounter], {x=-250, time=2000, onComplete=function(self) if(self~=nil) then display.remove(self) end end}) I know I can rotate things with transition.to( bullets[bulletCounter], { rotation = bullets[bulletCounter].rotation-360, time=2000, onComplete=spinImage } ) But how do I make the...

Physical body not responding in Corona SDK

lua,box2d,corona
I just started making my first Corona game, and have already run into a problem. In the code below, the crate is supposed to bounce off the line that the user has drawn, but for some reason, the crate just keeps moving, as if the line is not even there....

How to constantly check the location of an object in lua

lua,corona
I am working on a game that involves drawing lines to guide a physics ball into a bucket at the bottom of the screen. However, sometimes the user might draw the lines poorly, and the balls will become stuck. To rid this I would like to check the position of...

Mask not working in corona SDK

lua,corona
All I trying to do is to have part of my image showing and have the rest hidden. In the end I'll have the showing part clickable and I am having some trouble getting the mask to work. Here is my code: streams[0] = widget.newButton { width = display.contentWidth, height...

What does this warning mean in corona sdk console?

corona
I am getting the following warning in corona sdk console whenever i run my game WARNING: Cannot create path for resource file 'level1.ccscene' b/c it doesn't exist ...

how can i get the angular Velocity of an object? corona, lua

lua,get,corona
I have a slowmotion mode and I need to get the angular Velocity of an object so I can make it slower. I am using corona, lua.

How to Draw Circle, incrementally, to create an animated fill effect (using Corona)

lua,geometry,corona,geometry-surface
I'm having trouble even figuring out where to start with this. ANY help would be highly appreciated! Using the Corona SDK I want to draw a circle that will slowly fill as a percentage increases. The fill effect will follow the path of the circle, going anti-clockwise until the entire...