Polygon Error

Hello everyone,

I’m trying to create a polygon for a game I’m working on. THe basic idea is the get a ball into this goal: http://dl.dropbox.com/u/11226349/goal.png

However, Corona blacks out the screen on the simulator and returns the error message:
\main.lua:50: ‘}’ expected near ‘shape’

The code I wrote is as follows:

local goal = display.newImage("goal.png")   
goal.x = 130; goal.y = 420; goalShape = { -24,-29, 24,-29, 24,29, -24,29, -24,21, 16,21, 16,-29, -24,-29, }  
physics.addBody( goal, "static", { density = 1.0, friction = 0.3, bounce = 0.2 shape=goalShape } )  

The lines correspond to lines 48, 49, and 50 of my program.

I’m not sure what I’m doing wrong. The polygon has 8 vertexes, and I’ve tried removing the space between the shape=goalShape code & } symbol, but I get the same error. Can anyone help me troubleshoot? [import]uid: 100403 topic_id: 20903 reply_id: 320903[/import]

YOU SAID:

The code I wrote is as follows:
[lua]local goal = display.newImage(“goal.png”)
goal.x = 130; goal.y = 420; goalShape = { -24,-29, 24,-29, 24,29, -24,29, -24,21, 16,21, 16,-29, -24,-29, }
physics.addBody( goal, “static”, { density = 1.0, friction = 0.3, bounce = 0.2 shape=goalShape } )
The lines correspond to lines 48, 49, and 50 of my program.

I SAY:

[lua]local goal = display.newImage(“goal.png”)
goal.x = 130; goal.y = 420; goalShape = { -24,-29, 24,-29, 24,29, -24,29, -24,21, 16,21, 16,-29, -24,-29, }
physics.addBody( goal, “static”, { density = 1.0, friction = 0.3, bounce = 0.2, shape=goalShape } )[/lua] [import]uid: 89165 topic_id: 20903 reply_id: 82402[/import]

Hello,

Correct RSC, also I believe there is a extra comma at the end
of line 49 after -29 and curly bracket :wink:
Good luck!

Larry

“Follow Your Dreams” [import]uid: 107633 topic_id: 20903 reply_id: 82404[/import]

The missing comma was the problem. (I fell like an idiot…)

The program works now, but the ball seems to halt upon colliding with the air around the goal box. I assume I incorrectly wrote the vertex values (The goal appears off in the hybrid view), so I’ll get started on fixing that.

Thanks for the help! [import]uid: 100403 topic_id: 20903 reply_id: 82405[/import]

@oakes - You welcome!

PS: Do not feel it, I say you because is with mistakes that we get read to make the right ones! :slight_smile:

Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20903 reply_id: 82406[/import]

What an awesome thread to come into - Rodrigo and Larry, good on you guys!

Oakes - when I was new to Corona I made about 100 errors like this, I still do it from time to time but I always know where to look now - so don’t let it get you down. It happens to everyone.

At least you haven’t made a thread nagging Carlos to help you with Facebook. (Yeah, I really did that.)

Peach :wink: [import]uid: 52491 topic_id: 20903 reply_id: 82421[/import]

Mrs. @Peach,

Help is my personal LAW. :slight_smile:

BTW Does exist any human being that get/got to live without HELP?
PS: If YES, please, prove me it. Anyway even to born we need the doctors help or did you see someone jump out from the mothers belly? :wink:
PEACE & LOVE,
Rodrigo. [import]uid: 89165 topic_id: 20903 reply_id: 82505[/import]

Haha, very amusing and very true. <3

Peach :slight_smile: [import]uid: 52491 topic_id: 20903 reply_id: 82644[/import]

Cheers! :wink: [import]uid: 89165 topic_id: 20903 reply_id: 82662[/import]