corona

Collision of a line and object ( Corona SDK )

ぃ、小莉子 提交于 2019-12-25 05:24:27
问题 I am developing a game when there is a line and physics object The line code is: And the interesting thing is that when i code print ("collision is here") (for ex) they some how don't even collide! Both line and obj bodies are static How can make this collision happed? thanks in advance! 回答1: Static bodies can't collide with each other, but this question has a solution. 回答2: IF both lines are static make a function where you detect the x and y of both object and make equation accordingly, for

Display random objects in corona without overlapping on the other objects on screen

折月煮酒 提交于 2019-12-25 04:22:19
问题 I want to display random objects on the screen i have one ball but the objects been generated are overlapping with the ball i want to get the coordinated of the ball and according to that only shift the random objects. I am trying like below snippet. local ballX=ball.x local ballY=ball.y local xPos=generate_random(40,600) local yPos=generate_random(40,920) if(xPos>=ballX and xPos<=ballX) or (yPos>=ballY and yPos<=ballY) then objplace.x=xPos+150 objplace.y=yPos+150 else objplace.x=xPos

Attempt to compare nil with number in game [duplicate]

ε祈祈猫儿з 提交于 2019-12-25 04:12:11
问题 This question already has an answer here : attempt to compare nil with number Corona (1 answer) Closed 6 years ago . hey guys i am about to finish my game i am a indie developer and i i am trying to finish my app in corona sdk and i keep getting this annoying error message. The message is get is " Attempt to compare nil with number restart.lua 9 " i don't have a clue how to fix this i try every thing but nothing works. when i run my code and i die for the first time and restart the game it

In Corona SDK, how do I limit the number of lines drawn to one?

ε祈祈猫儿з 提交于 2019-12-25 03:53:18
问题 If I move the mouse off the line path when drawing a line, new lines continue appearing from the same center point. I have been trying to limit it to one line only, but I've not had much success. This is my code so far: local lines = {} local lineGroup = display.newGroup() local prevX,prevY local isDrawing = false local i = 0 local function distanceBetween(x1, y1, x2, y2) local dist_x = x2 - x1 local dist_y = y2 - y1 local distanceBetween = math.sqrt((dist_x*dist_x) + (dist_y*dist_y)) return

Corona - works on simulator but not on real Android device (system.pathForFile)

女生的网名这么多〃 提交于 2019-12-25 03:45:50
问题 I have this simple line of code that works perfectly on the simulator but gets a nil on a actual android device: local path = system.pathForFile( nil, system.ResourceDirectory) print('path', path) path = path .. "/assets/audios" on the android device I get Runtime Error .......attempt to concatenate local 'path' (a nil value) I read the the android docs and it says you don't need permission to read the internal storage. What's causing this error? How to solve it? Do I need to add any special

Admob response loadFaild

天大地大妈咪最大 提交于 2019-12-25 02:28:31
问题 I have built a Corona SDK app that I want to contains ads (using an Admob). I have 2 apps: one that I already published to the Google play and what I needed now is to republish it with an ad banner. And a second app that I haven't published at all. When I tried to insert banner to my app that I already published it's shows the banner properly but when I tried to add the SAME impletation to the app I haven't published yet I received constantly "error code 3". So, my question is: Is admob

Corona SDK preload images and physics bodies

杀马特。学长 韩版系。学妹 提交于 2019-12-25 01:58:59
问题 I am creating a game that generates random landscapes that the character drives along. There are 7 "sections" right now, and there will probably be 25 or so total. For example, one section is a hill, one is a ramp, etc. I am loading these images and physics bodies (whch are made with Physics Editor) when the character passes halfway between the previous section. The previous section is also destroyed. There is a frame rate skip when this function is called because it is loading these images

Move Scene in corona

女生的网名这么多〃 提交于 2019-12-25 01:44:57
问题 I am new to corona and my Problem id I have a long scene and in that I have a ball body. When it moves up i want to move the scene up. How to do this in Corona. 回答1: This is done using a display group to contain your entire scene (the level, the ball, everything) and then move that display group. Physics in Corona don't work between display groups for this very reason, so that that you can move the scene without affecting physics inside the scene. Refer to the "Egg Breaker" sample project. 来源

collision detection doesn't work inside scene:show

泪湿孤枕 提交于 2019-12-24 23:19:36
问题 I'm trying to detect collision on two object inside my scene:show function This is my first set of objects which have a collision listener on it for i = 1, table.maxn(layout.playgrid) do physics.addBody( leftholes[i], "static" ) sceneGroup:insert(3,leftholes[i]) leftholes[i].name = "hole" leftholes[i]:addEventListener( "collision", lis ) physics.addBody( rightholes[i], "static") sceneGroup:insert(3,rightholes[i]) rightholes[i].name = "hole" rightholes[i]:addEventListener( "collision", lis )

Corona facebook.logout() when the Official Facebook app is installed on device

随声附和 提交于 2019-12-24 18:36:20
问题 I have a little issue when I want to logout from Facebook and the official Facebook app is installed on device. After facebook.logout() is called then I call the new facebook.login( appId, fbListener, {"publish_stream"} ) that doesn't call the app for new user, simple log in with the old username and password. 回答1: That's how it is meant to work if the user is logged in to their account on the official FB app, it's supposed to simplify the process, if I recall correctly. (May want to refer to