corona

How to make one display group stay fixed in every scene in Corona?

僤鯓⒐⒋嵵緔 提交于 2019-12-24 17:01:08
问题 I have a level and status bar display group and I want this group stay at the same place when the scene changes. How can I achieve this? I am using director class for scene changes. 回答1: Do you want an object/group appear in every scene..? Then you can do as follows: -- main.lua -- local director=require("director") local maingroup=display.newGroup() maingroup:insert(director.directorView) director:changeScene("menu") return maingroup -- status.lua -- local function myObject(group,x,y

Corona Simulator Syntax Error (Unexpected Symbol)

假装没事ソ 提交于 2019-12-24 16:25:33
问题 I am making a Lua app. Here is the main.lua code: (This is on Mac.) display.setStatusBar (display.HiddenStatusBar) local main.lua = require ("main.lua") --[LINE WITH ERROR] local director = require ("director") local mainGroup = display.newGroup() local function main() mainGroup:insert(director.directorView) director:changeScene("mainPage") return true end main() And here is my error report after, it is pretty simple, but I'm not sure what it is about: Corona Simulator Syntax Error File:

Touch Event detection issue

核能气质少年 提交于 2019-12-24 14:06:54
问题 when you add event listener to an object and moved outside that object event.phase == "ended" will not be trigger because it detected outside the object. my question: is there a way we can detect event.phase == "ended" even if the user releases the touch outside the object or is there any other way we can detect if the user has lifted their finger without using Runtime event listener? 回答1: You can try the following method: local bg = display.newRect(0,0,display.contentWidth,display

AddEventListener: Listener cannot be nil

时间秒杀一切 提交于 2019-12-24 09:48:23
问题 Can someone please explain what is going wrong here? It went wrong as soon as I added the AddEventListener newBalloon:addEventListener( "tap", pushBalloon ) Complete Code: local composer = require( "composer" ) local scene = composer.newScene() local physics = require( "physics" ) physics.start() -- Configure image sheet local positioninsheetOptions = 144.1 local sheetOptions = { frames = { { x = 0, y = 0, width = 112, height = 142 }, { x = 0, y = positioninsheetOptions, width = 112, height =

Attempt to concatenate global 'q101' (a nil value)

匆匆过客 提交于 2019-12-24 02:30:13
问题 i like to load text form a external .lua file in to my game, here is a little test i setup to test the principal, i know if i give "q101" numbers like so "q101 = 123456" the code displays the numbers 123456 but i don't understand why it doesn't with letters. Can some one please explain how i can do this is the right way, as this is clearly not the way of doing it q101 = HELLO Q1 = display.newText("".. q101, 160, 20, MYRIADPRO, 30) Q1:setTextColor( 255, 255, 2552) Q1.x = display.contentWidth/2

Create multiple variables using for loop in lua

限于喜欢 提交于 2019-12-24 02:07:40
问题 I want to use a for loop to create multiple varibles (with names that are the same except for the last character) in lua for i= 1, 10, 1 do marker+i = "do things" end pretty much I what I want to get is: marker0, marker1, marker2 and so on. and I guess there is something wrong with marker+i I get an error. Thank you. 回答1: You probably don't want to do this actually. Much simpler would be to create a table and create those variables as keys in the table. t={} for i=1, 10, 1 do t["marker"..i] =

Local Notifications for Corona SDK (Android)

僤鯓⒐⒋嵵緔 提交于 2019-12-24 00:57:09
问题 Is there a way to implement local notifications while using the Corona SDK? This is android specific, as we have already found the iOS directions. Cheers! 回答1: Local notification for now is iOS only on Corona... The Android version is not done yet. When it gets done I will see to edit this with the directions of the android version. 回答2: Local notifications are done for iOS and Android: http://docs.coronalabs.com/api/library/system/scheduleNotification.html It doesn't appear there is a way to

Physics object passing through wall object in corona sdk

百般思念 提交于 2019-12-24 00:55:07
问题 I am hitting a ball with a force and there is a wall which is assigned a physics property and is static, but the ball is dynamic, the problem is when enough force is applied to the ball it passes through the wall, it is a type of table wall as in sample simple pool game. I have used ball.isBullet=true but same problem is there. Please suggest how to solve it.. thanks 回答1: This is a fairly common issue when dealing with small, fast-moving objects. Typically, the best solution is to make the

How can I get the colour (fill) of a DisplayObject in response to an event like a touch in Corona SDK?

妖精的绣舞 提交于 2019-12-23 18:52:04
问题 Can anyone help me find out how can I can get the color of rectangle in corona? That rectangle I already filled with color, so now I want to get that color when I touch on rectangle. 回答1: Create your rectangle: local rectangle = display.newRect(0, 0, 100, 100) Put your color in RGBA (you can leave out the A) format in a table, and store it as a "custom property" for the rectangle: rectangle.fillColor = {110, 30, 25} Through the magic of the unpack function, which returns the values of a table

How to mail a screen captured image using corona SDK

霸气de小男生 提交于 2019-12-23 17:57:46
问题 I am new to corona SDK, but I've managed to capture my app scene using the following code: local function captureArea() local myCaptureImage = display.captureBounds(display.currentStage.contentBounds, true) myCaptureImage:removeSelf() myCaptureImage = nil end bg:addEventListener("tap",captureArea) This works perfectly. Now I need to send the captured image(with a specific name, say: screen_1.png ) to my friend via email. I've used Composing E-mail and SMS for refference, but I fail to