#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Retry Button

edited June 2013 in General Posts: 69

Can any one make a retry button when he lose and score when the sponge bob go to gold +5 in score and when is he fo up +10 pleas pleas pleas any one edit my code pleas

https://www.dropbox.com/s/8hmd1n7jbt1dmcv/Super spongeccode.txt

• Posts: 69

--# Super_sponge
Girl = class()

function Girl:init() -- you can accept and set parameters here
self.position = vec2(0,0)
self.velocity = vec2(0,0)
end

function Girl:jump(power)

``````       sound(SOUND_JUMP)
sound(DATA, "ZgJAQwBAJFE8dFZiGE9hv5j2Kj+6aI0/VQA5U0JyRyM/KEBC")
sound(DATA, "ZgBAMxhIOUVPThVAP49GPdcp/T7I9gQ/VwAucS9FLUA4M0BY")
``````

sound(DATA, "ZgBASAA2SWE/QARCRDw3v/yitT4NRLw+QABIRmNBQEEZInFs")
sound(DATA, "ZgBAQQA1USQHPnJHch1oP8oPPD9Un0M/QAA+f0BSRQdAY0t/")
sound(DATA, "ZgJAJgBAQEBAQEBAAAAAAJqZmT7NzMw+QABAf0BAQEBAQEBA")

local pow = power
if difficulty == "medium" then pow = pow - 12 end
if difficulty == "hard" then pow = pow - 10 end
self.velocity = self.velocity + vec2(0,pow)
end

function Girl:computeVelocity()
gravity = vec2(Gravity.x, math.min(Gravity.y,1)):normalize()
gravity = gravity * 13
friction = math.min(self.position.y, 1)
return self.velocity + gravity * friction
end

function Girl:update()
self.position = self.position + self:computeVelocity()

``````self.position.y = math.max(self.position.y,0)

self.position.x = math.max(self.position.x,-WIDTH/2)
self.position.x = math.min(self.position.x,WIDTH/2)

self.velocity = self.velocity * 0.98
``````

end

function Girl:isFalling()

`````` return self:computeVelocity().y < 0
``````

end

function Girl:draw()
self:update()
pushMatrix()
translate(self.position.x, self.position.y)

sprite("Documents:sponge bob")

end

--# Main

function setup()

-- project info

version = 1.0

saveProjectInfo("Description", "super sponge game")
saveProjectInfo("Date", "17st may 2013")
saveProjectInfo("Version", version)

print("super sponge v"..version.."\n")
print("this is the english version for this game ")

• Posts: 69

Or pleas make a code for score and retry buttoun and iwell put it

• Posts: 2,161

Your code doesn't appear to be all there. Please also read the FAQ on how to format code on the forum.

• Mod
Posts: 5,396

• edited June 2013 Posts: 69
``````--# Super_sponge

Girl = class()

function Girl:init() -- you can accept and set parameters here

self.position = vec2(0,0)

self.velocity = vec2(0,0)
end

function Girl:jump(power)

sound(SOUND_JUMP)

sound(DATA, "ZgJAQwBAJFE8dFZiGE9hv5j2Kj+6aI0/VQA5U0JyRyM/KEBC")

sound(DATA, "ZgBAMxhIOUVPThVAP49GPdcp/T7I9gQ/VwAucS9FLUA4M0BY")

sound(DATA, "ZgBASAA2SWE/QARCRDw3v/yitT4NRLw+QABIRmNBQEEZInFs")

sound(DATA, "ZgBAQQA1USQHPnJHch1oP8oPPD9Un0M/QAA+f0BSRQdAY0t/")

sound(DATA, "ZgJAJgBAQEBAQEBAAAAAAJqZmT7NzMw+QABAf0BAQEBAQEBA")

local pow = power

if difficulty == "medium" then pow = pow - 12 end

if difficulty == "hard" then pow = pow - 10 end

self.velocity = self.velocity + vec2(0,pow)

end

function Girl:computeVelocity()

gravity = vec2(Gravity.x, math.min(Gravity.y,1)):normalize()

gravity = gravity * 13

friction = math.min(self.position.y, 1)

return self.velocity + gravity * friction
end

function Girl:update()

self.position = self.position + self:computeVelocity()

self.position.y = math.max(self.position.y,0)

self.position.x = math.max(self.position.x,-WIDTH/2)

self.position.x = math.min(self.position.x,WIDTH/2)

self.velocity = self.velocity * 0.98
end

function Girl:isFalling()

return self:computeVelocity().y < 0

end

function Girl:draw()

self:update()

pushMatrix()

translate(self.position.x, self.position.y)

sprite("Documents:sponge bob")

end

--# Main

function setup()

-- project info

version = 1.0

saveProjectInfo("Description", "super sponge game")

saveProjectInfo("Date", "17st may 2013")

saveProjectInfo("Version", version)

print("super sponge v"..version.."\n")

print("this is the english version for this game ")

``````
• edited June 2013 Posts: 69
``````--# Super_sponge

Girl = class()

function Girl:init() -- you can accept and set parameters here

self.position = vec2(0,0)

self.velocity = vec2(0,0)
end

function Girl:jump(power)

sound(SOUND_JUMP)

sound(DATA, "ZgJAQwBAJFE8dFZiGE9hv5j2Kj+6aI0/VQA5U0JyRyM/KEBC")

sound(DATA, "ZgBAMxhIOUVPThVAP49GPdcp/T7I9gQ/VwAucS9FLUA4M0BY")

sound(DATA, "ZgBASAA2SWE/QARCRDw3v/yitT4NRLw+QABIRmNBQEEZInFs")

sound(DATA, "ZgBAQQA1USQHPnJHch1oP8oPPD9Un0M/QAA+f0BSRQdAY0t/")

sound(DATA, "ZgJAJgBAQEBAQEBAAAAAAJqZmT7NzMw+QABAf0BAQEBAQEBA")

local pow = power

if difficulty == "medium" then pow = pow - 12 end

if difficulty == "hard" then pow = pow - 10 end

self.velocity = self.velocity + vec2(0,pow)

end

function Girl:computeVelocity()

gravity = vec2(Gravity.x, math.min(Gravity.y,1)):normalize()

gravity = gravity * 13

friction = math.min(self.position.y, 1)

return self.velocity + gravity * friction
end

function Girl:update()

self.position = self.position + self:computeVelocity()

self.position.y = math.max(self.position.y,0)

self.position.x = math.max(self.position.x,-WIDTH/2)

self.position.x = math.min(self.position.x,WIDTH/2)

self.velocity = self.velocity * 0.98
end

function Girl:isFalling()

return self:computeVelocity().y < 0

end

function Girl:draw()

self:update()

pushMatrix()

translate(self.position.x, self.position.y)

sprite("Documents:sponge bob")

end

--# Main

function setup()

-- project info

version = 1.0

saveProjectInfo("Description", "super sponge game")

saveProjectInfo("Date", "17st may 2013")

saveProjectInfo("Version", version)

print("super sponge v"..version.."\n")

print("this is the english version for this game ")

``````
• Posts: 69

I ha e put it but the code doesn't appear

Give me your email and i well send he code to you

• Posts: 69
• edited June 2013 Posts: 1,976

No, only put the ~~~ at where the code you want to format first starts, and where it ends, not in between functions.

• Posts: 69

Ok help me if you now

• Posts: 1,976

Check if the character's dead, if she is, sprite a retry image in the middle of the screen, in function touched(touch) check if the character is dead and the finger is within the boundaries of the retry button (retry x - (retry width / 2), retry x + (retry width / 2), retry y - (retry height / 2), retry y + (retry height / 2)) and if so, reset the game. You can't expect a chunk of code to fall into your lap, though.

• Posts: 69

I can not edit pleas can edit it pleas

Pleas edit it

• Mod
Posts: 3,297

Just to know: how old are you Mohammed? This could explain that.

• edited June 2013 Posts: 1,976

It would require a lot of code in a lot of different parts, which makes it hard for me to write you code. Either way, it's good to code it yourself, get experience, and understand it. Also, I wouldn't put an app on the App Store with the trademarked Spongebob graphics. Or one very close to an example...

• edited June 2013 Posts: 871

@Mohammad_abumoosa - I understand you are young and eager but constantly asking for people to write you bits of code to add to your program is going to start to annoy people. @SkyTheCoder has already given you ample help by telling you how to write your button. In addition @ReefWing has an excellent tutorial on buttons here: http://codeatuts.blogspot.com.au/2012/06/tutorial-3-simple-button-class.html - have a go yourself - its the only way you'll learn. If you have a good go at it but still don't understand a part of it, ask a specific question about that part of it rather than "write me some code to do x pleas" - you'll find people are much more willing to help.

Finally, I commend you on your politeness, but please note the spelling of please (pleas is a correctly spelt word so the spell checker won't catch it)

• Mod
Posts: 3,297

Ok, now i get it better.
Mohammad, you are young but this is no excuse for being a jerk. You should ask you parents to read you posts and explain you that the way you ask for things is EXTREMELY RUDE and that you have to learn what POLITENESS is. If they however support the way you express youself, then this is hopeless...

• Mod
Posts: 5,396

I think much of the problem is that his English is not good, so he doesn't know how to ask.

Looking back, Mohammed has been a member since last July and has been asking similar questions (about Spongebob, yes) periodically, without much success, because his questions are unclear, and he keeps asking us to write chunks of code for him. Either he's looking for the easy route to fame and fortune, or he's an eager kid struggling with English as well as programming. I'm not sure what to do in either case, because his English is so poor that I don't see how he can even understand the code.

• Posts: 1,976

I would recommend reading as many books as possible, and asking your parents what words mean when you find one you don't know. That gets you good grammar.

• Posts: 69

Shut up all dont talk with me like thes iam 12 years old if you dosnt want to help me ......
Dont help me thers 100000000000000000 can help me not 4 bad mans like .....
Can you read thes (( dont translate it )) if you are baby you can translate it

انت تفهم عربي انا اعرف اشياء اكثر منك

No one can read this and i am from qatar i am from arabic country

• Posts: 69

Finaly but shose in your mourh

• Posts: 69

mouth

• edited August 2013 Posts: 2,048

EDIT: Removed

• edited June 2013 Posts: 1,976

@Mohammad_abumoosa I'm eleven years old, and I'm not trying to be mean to you, I'm just saying that you really can't expect code to fall into your lap, and I know it doesn't seem like it to you, but it can be hard to tell what you're asking, and since most programming languages (including Lua) are based off of English, I really think you should work on your grammar before you program too much. And really, like @Ignatz said, you can post a small question he and get a few good examples and answers, but pretty much everything you ask for requires code in setup(), draw(), and touched(touch). I think maybe you should try looking at a different example, and digging into the code to see how it works. You'll want quite a bit of experience before you make a full-blown game. I would like to see any small examples or bits of code you made, and I'm sure everyone else would like to, too. Good luck on your quest of programming!

• Mod
Posts: 9,257

@Mohammad_abumoose. انت تفهم عربي انا اعرف اشياء اكثر منك You are understanding Arabic I know more things than you. I don't know if that is the correct translation or not. If you want people to help you, you need to supply all of the code. I loaded your code, but it didn't work because it's missing classes. Without having all of the code, it's harder for us to figure out what you want then it is for you to figure it out. You know how your game is supposed to work, we don't. Formatting the code and removing all of the blank lines will make it easier to read and make it smaller to post. Everyone here is willing to help, but we can't help you if you don't help us.

• Mod
Posts: 5,396

@Mohammed - we don't mind how old you are, or where you come from. We are all brothers here, and we all want to help. But it is hard to understand what you are asking.

• Posts: 69

I am sorry for that but did you now i work on my app 6 moth on codea and there s many different
And i well upload it After tow weeks but theres to thing they
I can read very well english and i can write i am the first excellent boy in all grad 7 and my hoppy is computer and i love the electronic things iam sorry for that

• Posts: 69

And its correct translation

@dave1707

• Posts: 69

@dave1707
Ok i read your comment ok pleas give me steps to format my code

• Posts: 2,161

I am going to close this discussion. I've seen too many internet discussions trail on long after they should have stopped just because everyone wants to get in the last word.

This is purely to close this discussion and let everyone draw breath, it is not to censure anyone.