Free Developer Support

Hey Everyone,

I've been using the Corona for a while and I want to take some of my time to contribute. Here's what I wanna do:

Each week, I'll take requests to either fix, critique, or write a set of code for an hour's worth of time, free of charge.

To submit your code or have any questions, respond in this post or message me with your issue.

-Happy Coding
JT

Very generous of you :) I'm sure many will avail of your offer

Awesome! That's very nice of you. Email me at ninjapig123 [at] gmail [.com].

Regards,
Jordan Schuetz
Ninja Pig Studios

OMG, James, this is an incredible offer. I just wouldn't want to waste this precious opportunity to get help, so I'll think very carefully about what help-request I'd make, but I sure will take up on your offer when I'm totally stuck.

Naomi

Proper Facebook Friends List

This may be a bit ambitious for this request but I've been struggling with this problem for awhile now and I'm sure it would help tons of other people...

How would you go about creating a fleshed out Facebook friends list? Similar to this picture:

I'm able to make a basic list that pulls in the pictures and names of friends but I can't for the life of me figure out how to:

1. Sort the list alphabetically

2. Add the category rows so that only the letters show up in them (see how it shows B, C, D and E by themselves)

3. Implement a quick-scoll-esque legend on the right side of the screen

Again, this may be too much for an hour's worth of work but ANY help on the matter would be extremely appreciated :)

Thanks so much in advance for doing this! I can't wait to see what other requests come through here...

R

I have to admit that if you could take a quick look at my documented issue,
that would greatly help me.

-> attempt to call method 'move' (a nil value)

@Everyone,
Thanks for the support! I'm happy to help and I can't wait to see the interesting cases that come from it!

Speeking of cases....

@R,
I'll see how much I can do and keep you informed. What's the code for the kind of view you're using to make your facebook page? I want to make sure what I'm writing is an easy plug and play for what you have.

@Mells
I'll take a look at it and update you when I'm done

Hey,

Thanks for doing this! I would love for someone to help me with my problems :)

My email is: michaelas@eb.org

Thanks!

- Michael

@Mells
When you call the function setmetatable, it erases the other metatable and replaces it with the most recent one. It's usually used for assigning one 'class'. In order to do proper multiple inheritances, you would need to do a more programming and it gets a bit complicated. Instead I use a simpler method for inheritance that is almost identical to what someone linked to on your forum post:

main.lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--NEVER USE GLOBAL OBJECTS. ALWAYS STORE THINGS LOCALLY
local Balls_Class = require ("balls")
require ("libraries")
 
local Game = {}
 
 
function Game:startSetup()      
        local listBalls = Balls_Class.newBalls()      
                      
        print (listBalls[1].x) -- Displays "400", great until there
 
        listBalls[1]:move(50) -- Doesn't work.How can I access function move() in ball.lua
 
end
 
Game:startSetup()

Thank you very much JT, I could achieve what I was expecting :)
The comments were really helpful.

I might have something more to ask if it's ok, but I'm not sure if I should post my questions here or in my own thread?
I am trying to learn from lua-users and would love to see the way you would do the following with my example :
In order to do proper multiple inheritances, you would need to do a more programming and it gets a bit complicated

I do understand the reasons why you are advising me that simple way to achieve things and I will clearly use it in the future.

But I'd also like to know how to do it "the other way" if possible.

My reasons are that :
1. most part of the docs at lua-users use metatables and I'm ok to learn things the hard way today if this is a wise time investment for later
2. it seems that there were a lot of things said against the use of package.seeall and advised by Ansca.
I believe that the tutorials in the future will take that in account, so I would like to be able to follow and understand it.

I believe that learning how to do things with metatables is a wise investment and the exercise I'm doing with (Balls) is a good one for a start?

I don't want to take so much of your time so :
- Would please you help me learn how to use metatables and do multiple inheritances in my exercise?
- Or point me to the correct way of learning about it so I can complete my exercise?

Any help would be greatly appreciated, thanks again JT for taking the time.

Learning multiple inheritance is good to know for using lua, but probably not worth the trouble for using corona. Not sure if you can see how the code works under the hood of the SDK and you may be conflicting certain ideologies that the code is based on. I choose that way for Corona because:
A. It's easy to implement
B. Maintains the integrity of the object I'm working with

If you would like to know more about multiple inheritance, you can definitely start with this:
http://lua-users.org/wiki/SampleCode

JT,

Your offer sounds great!! Would you consider helping me make some modifications to some code Carlos created....the following link is to the code.

http://developer.anscamobile.com/code/bezier-object-along-curves-path

This is what I need and I have spent four days reading though docs and example code.

I want to make an object follow a predetermined path(s) with the option select a choice to make a change in direction along the path to another path.

I want this to run with a user "touch" event (via a button/slider) listener with increase-able/decrease-able speed; not at the enterFrame Runtime.

I know I can make an object go from point A to B via a transition.to however; I am looking for something to be able to follow a line that potentially has an "S" curve in it.

Rob Miracle suggest the use of a Table; I have reviewed the code from the link above and almost have a handle on it. But instead of picking four point on the screen to place the curve or path. I just want to be able to "set" the path with the speed slider on the screen to make my object accelerate.

If this is asking for too much I understand; but the concept of Tables is making me nutz right now. I need a working example to be able to break it down to something I understand.

Thanks a million.
Rob

Edit : I found why I couldn't achieve such a basic thing :
It's not possible to set the metatable of display objects
ok, I got that when I do :

1
2
3
local new_inst = display.newCircle(default_xpos, default_ypos, default_radius )
new_inst.note = 20
return setmetatable(new_inst, Ball_mt)

What is the

proper way to end a Corona program

when the home button is pressed?

Corona Simulator[3092:903] Connection error: (corona.update2)

When running the debugger on all of the last 6 releases I receive this message:

Ansca Corona Remote Debugger
Run the program you wish to debug
2012-01-27 12:40:47.620 Corona Simulator[3092:903] Connection error: (corona.update2) fault(Token has expired.)
2012-01-27 12:40:47.624 Corona Simulator[3092:903] Connection error: (corona.update2) ({
"/FaultCode" = 1;
"/FaultString" = "Token has expired.";
"/kWSHTTPResponseMessage" = "{url = http://developer.anscamobile.com/services/xmlrpc; status = HTTP/1.1 200 OK}";
"/kWSResultIsFault" = 1;
})

I can't seem to get an answer on this and am not knowing if this affects anything else that might lead to problems.

I am on Snow Leopard 10.6.8

Thanks!

Oh, this is so fantastic - a pro developer offer he's valuable time to help us.

I am in the end of my first game development - its a classic platform game. All gameplay is almost done and the rest is just leveldesign. One thing that I am not that happy with is the attachment of the player to my moving platforms. The game is running in physics mode, so the weight of the player makes him just slip of the platform. I managed to solve this issue but I am not 100% satisfied with the result.

There are a lot of fragments of code in several of listeners and functions. Do you have time to help me look at it? If so, should I post all of my fragments here or what is the best solution?

Best regards, Joakim - Sweden

Hi jamestimberlakejr, this is a great help to us, thanks for the availability, I have a question that I have some doubts and is the most important part of my application, i am trying to create a object like that: http://www.youtube.com/watch?v=vQiEcqSjmo8

see the elastic effect of the object, the green elastic. i tried to use joints but it isnt good because when i pull the joints will separate a little, how i can create some like it? what i should use etc

Thanks jamestimberlakejr

Wow! Awesome requests so far everyone. I should have some results for these by tomorrow.

P.S. @R Please provide me with the code you're using to make your tableview so I can modify it. I want to make the code fit like a glove on your existing project.

@Rob Haney,

I'm not sure what you mean by "set"? Do you mean have the user use their finger to draw the path?

@Moilefun,
Could you specify a bit more? I'm not sure if you're talking about an application or the simulator or the sdk itself.

@JK,
I don't know what your code looks like, but try increasing the friction of the surface of the platform. Show some code on here and I'll see what I can come up with

This happens when I run the debugger from within the Corona SDK folder on my (2008) MacBook Pro.

Steps to recreate problem:
1). Open the SDK folder in the Applications Folder. Corona version: 2012.731 (2012.12.8) on my Mac
2). Double click the debugger program.
3.) View error messages in terminal window.
4.). Note: I can run any programs I want.
5.). Note: I can build for device.

@James, I managed to tweak my platform code so it is ok now. Thanks for your generosity!

Joakim

Ok, this one is maybe an easy one?

Is there something I can do by code in the event onFrame to "slow down" my moving player in the physics world?

1
2
3
4
if(ball.speed.x > 15 or ball.speed.y > 15) then
 ball.speed.x = 15
 ball.speed.y = 15
end

JT,

Basically I would like to have 3-4 predetermined paths. All starting with the same segment then have a "fork-in-the-road".

At the point of the "intersection" i want the user to pick the direction they we to go. ....

With this, i need to know how to go forward & reverse repeatedly; changing the "intersection" choice at will.

(also if the try to travel past the intersection without changing it the object will crash/explode.

Is this something that can be done without physics? I am not sure I want to tackle that yet.

If this is too much I completely understand. Maybe if you wouldn't mind you can guide/Tutor me along the way.

Thanks for your assistance and direction.
Rob
rob at katnapapps [dot] com

Hey James,

sorry for the late response but I'm having a rough time figuring out how to send you a private message or email... Can you provide me your email address or let me know how to send you a pm and I'll send along my lua file.

Thanks so much for this!

@Mobilefun
That's never happened to me and I can't reproduce this issue. I'm really not sure how to tackle that one until I can at least recreate it. Is there something you may have done to create it?

@Blickon
I don't think there's a way right now to stop the separating effect because it would involve modifying the pixels of the graphics. The methods I can think of right now is trying to mask the "breaking" effect you get from the joints. I would suggest trying to use smaller joint objects at a higher number for your elastic effect.

That should make the the "breaking" effect look less obvious ( but I'm not sure how it will affect your performance ). If you have some code that you are already working on, let me see it and I could test it for you.

@jk
Sure. If you are using physics, you can set an impulse force negative to the current velocity that the player has. If your speed is done by moving it through the x and y coordinates, keep a universal variable that you use to determine speed and do subtraction on it based on the event frame.

Also, if you're using animations and you want the effect of the animation slowing down, you can use the timescale property sprites have that determine their animation speed ( 1 is default ). Let me know if this helps.

@Rob
You can do this without physics, but you will probably run into performance issues because you want to do checks based on where the player is, but if you'd like to try, you can make an event listener that always runs and in it you translate the x and y coordinates along the path you want.

My advice would be to have the paths you have in that link, but have them set up with invisible checkpoint objects equally along the path. When the person signals to take a turn, you make a check to determine the current location of their car along a given path. If there is a checkpoint nearby, they become jointed to that and the checkpoint runs the path with the object being dragged along with it. When the person detaches from the checkpoint, the checkpoint goes back to its original position and you can select it again.

Going forward and reverse would be based on a value belonging to the persons car. When the car attaches to the checkpoint, the checkpoint checks if the car wants to go forward or backward. If forward, then the checkpoint moves to the next highest part of the path and vice versa.

I know this is a lot, but if you need any more assistance while making the code or need any more clarification, please let me know.

@Ram
If you need to send me your code, please send it at jamestimberlakejr[at]gmail[dot]com for your code submission, but make sure to post here so I know to check.

@jamestimberlakejr,

I've been doing something similar (helping out on the forums), but I like your approach. A direct offer to help.

I will offer the same thing. Anyone that needs help can contact me at: ken[at]homebrewsoftware[dot]com

I cannot promise to solve all questions, but I will do what I can to help out.

Also, if you've already asked james for help, I don't want to interfere in any support issues he is working on. Please ask ONE of us for help, not both of us unless the first person you ask says he doesn't have time.

In general I prefer to post solutions to problems here on the forums, so other users can learn too. However, if you have something you want kept private I will respect that as long as you let me know that upfront.

WOW @Ken, that`s amazing! Thanks James & Ken for offering free help! OMG it is awesome from both of you IMHO!

Cheers,
Rodrigo.

Hi jamestimberlakejr, thanks for all your availability, how i can send you the code?

Hi James .. great idea and offer

would you like to see this :
2 Questions regarding "Page Curl" :
http://developer.anscamobile.com/node/20435

thanks alot

@James,

I added two variables to get the current velocity.

In my onFrame event I was checking if they went to far and did a reverse of the "power" - but that made my player just bumping around uncontrolled. Do you think you can provide some small code samples?

Joakim

@Ken,
That's awesome. I'm glad that someone else is also doing this too. I'll send you an email.

@Blickon
You can send me your code at jamestimberlakejr[at]gmail[dot]com

@iAZZ
I'll take a look at it tonight and see what I can do.

@jk
I need to see the way you're doing it so I can point you into the right direction. Post me your code of how you're doing it and I can revise it. If you don't feel comfortable with that, then use email.

@Ken,
That's awesome. I'm glad that someone else is also doing this too. I'll send you an email.

@Blickon
You can send me your code at jamestimberlakejr[at]gmail[dot]com

@iAZZ
I'll take a look at it tonight and see what I can do.

@jk
I need to see the way you're doing it so I can point you into the right direction. Post me your code of how you're doing it and I can revise it. If you don't feel comfortable with that, then use email.

@Rc, Thanks. I really appreciate the support.

Hi, well I maybe looks stupid but I couldn't think of any other direction then this.

I putted it in onFrame event....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
        --============================================================
-- FRAME LISTENER
--============================================================
local function onFrame()
        Particles.Update()      
 
        --Check if game is running
    
        if(isPlaying) then
                
                --Check speed of player and put on brakes if he is going to fast...
                vx, vy = ball:getLinearVelocity()
        
                if(vx > 200) then
                        ball:applyLinearImpulse( -200, 0, ball.x, ball.y )
                end
                        
 
                        --Control camera movment
                        gameGroup.x = (ball.x * -1)+240
                                
                        if(ball.y<250) then
                                if(ball.y>-100) then
                                        gameGroup.y =  ((ball.y * -1) +250)-5
                                        ball.jumping = true
                                        if gameGroup.y < 1 then
                                                gameGroup.y=1
                                        end
                                end
                        end
                        
                
                --Move the parallax
                myParallax:setPosition(myParallax.position.x + lastBallX - ball.x, 0)   
 
                lastBallX = ball.x      
                lastBallY = ball.y
                
                --Check if player is on moving platform - if so, make it follow
                if attachedPlatform then
                        ball.x = ActivePlatform.x - PlatformOffset
                        ball.jumping = true
                end
        end
 
end

@ jamestimberlakejr

Just sent you an email. Thanks!

@jk,
Why not try modifying the velocity of the object directly then?

1
2
3
4
                if(vx > 200) then
                     -- use zero to stop, -200 to go backwards
                        ball:setLinearVelocity( -200, vy )
                end

@James, that did the trick. Thanks!

Joakim

Hi james , here is the full code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
-- hide the status bar
display.setStatusBar( display.HiddenStatusBar )
 
-- create example pages
local page1 = display.newImageRect( "page1.jpg", display.contentWidth, display.contentHeight )
page1:setReferencePoint( display.TopleftReferencePoint )
page1.x, page1.y = display.contentWidth*0.5, display.contentHeight*0.5
 
local page2 = display.newImageRect( "page2.jpg", display.contentWidth, display.contentHeight )
page2.x, page2.y = display.contentWidth*0.5, display.contentHeight*0.5
page2:toBack()
 
local page3 = display.newImageRect( "page3.jpg", display.contentWidth, display.contentHeight )
page3:setReferencePoint( display.TopleftReferencePoint )
page3.x, page3.y = display.contentWidth*0.5, display.contentHeight*0.5
page3:toBack()
 
local page4 = display.newImageRect( "page4.jpg", display.contentWidth, display.contentHeight )
page4.x, page4.y = display.contentWidth*0.5, display.contentHeight*0.5
page4:toBack()
 
 
local curlPage = display.newImageRect( "curlPage.png", display.contentWidth, display.contentHeight )
curlPage.x, curlPage.y = display.contentWidth*0.5, display.contentHeight*0.5
curlPage.isVisible = false
 
-- group to hold the page that will be turned (as well as the "curl" page)
local turnGroup = display.newGroup()
 
-- The following function will turn the page "back"
local function gotoPrevious( curlPage, time )
        
        local time = time or 500
        
        curlPage.isVisible = true
        local hideCurl = function()
                curlPage.isVisible = false
                turnGroup:setMask( nil )
        end
        transition.to( turnGroup, {maskX=display.contentWidth*0.5+100, time=time } )
        transition.to( curlPage, { rotation=45, x=display.contentWidth+(display.contentWidth*0.10)
        , y=display.contentHeight + (display.contentHeight*0.25), time=time, onComplete=hideCurl })
end
 
 
-- The following function will turn the page "forward"
local function gotoNext( currentPage, curlPage, time )
        -- add "pages" to page turning group
        turnGroup:insert( currentPage)
        turnGroup:insert( curlPage )
        
        -- mask should match dimensions of content (e.g. content width/height)
        local curlMask = graphics.newMask( "mask_640x960.png" ) -- iPhone portrait
        --local curlMask = graphics.newMask( "mask_768x1024.png" )      -- iPad portrait
        turnGroup:setMask( curlMask )
        
        -- set initial mask position
        turnGroup.maskX = display.contentWidth * 0.5+100
        turnGroup.maskY = display.contentHeight * 0.5
 
        -- prepare the page-to-be-turned and the curl image
        currentPage:setReferencePoint( display.BottomRightReferencePoint )
        curlPage:setReferencePoint( display.BottomRightReferencePoint )
        curlPage.rotation = 45
        curlPage.x = display.contentWidth+(display.contentWidth*0.10)
        curlPage.y = display.contentHeight + (display.contentHeight*0.25)
        curlPage.isVisible = true
        
        -- show pagecurl animation and transition away (next page should already be in position)
        local time = time or 500
        transition.to( turnGroup, { maskX=-display.contentWidth*0.75, time=time } )
        transition.to( curlPage, { rotation=0, x=0, y=display.contentHeight+20, time=time} )
        curlPage.yScale = curlPage.y * 0.2
end
 
local function swipe(event)
          local swipeLength = math.abs(event.x - event.xStart) 
          local currentPage = event.target
                  if event.phase == "moved"  then
                        if event.xStart > event.x then
                                        gotoNext (currentPage, curlPage, 1000)
                elseif event.x > event.xStart then
                                    gotoPrevious(curlPage,1000)
                                end
           end
           return true
end
 
page1:addEventListener( "touch" , function() gotoNext( page1,curlPage,1000 ) return true end )
page2:addEventListener( "touch" , swipe )
page3:addEventListener( "touch" , swipe )
page4:addEventListener( "touch" , function() gotoPrevious(curlPage,1000) return true end )
views:1875 update:2012/2/7 8:40:54
corona forums © 2003-2011