# Bouncy Ball ( plz edit and send back)

Hey guys,
I am a beginner at this stuff but I managed to create a small project with the help of @saturn031000. I would really like it if y’all would edit it, make it better, and then post it back. Thx
Here is the code:

``````
--# Main
-- Bouncy Ball
supportedOrientations(LANDSCAPE_ANY)
-- Use this function to perform your initial setup
function setup()
FillColor=color(0, 103, 255, 255)
BackColor=color(13, 255, 0, 255)
StrokeColor=color(255, 0, 5, 255)
parameter.number("Mov",0,1024,Mov)
parameter.number("A",0,HEIGHT,A)
parameter.color("FillColor", FillColor)
parameter.color("BackColor", BackColor)
parameter.color("StrokeColor", StrokeColor)
displayMode(OVERLAY)
print("BUNGEE JUMPING!!!!")
V=7
Mov=WIDTH/2
A=HEIGHT/2
VA=10
end

-- This function gets called once every frame
function touched(touch)
if touch.state==ENDED then
V=-V
VA=-VA
end

end

function draw()
-- This sets a dark background color
background(BackColor)
fill(FillColor)
stroke(StrokeColor)
-- This sets the line thickness
--  FillColor=math.random(0, 255)
strokeWidth(5)
fontSize(100)
font("Copperplate-Bold")
text("Whee!", WIDTH/2, 700)
line(0,HEIGHT/2,Mov,A)
line(WIDTH,HEIGHT/2,Mov,A)
ellipse(Mov, A, 50)
-- sprite("Space Art:Asteroid Large", Mov, A)
Mov = Mov + V
A = A + VA
if A>HEIGHT-25 or A<25 then
VA=-VA
end
if Mov>WIDTH-25 or Mov<25 then
V=-V
end
end
``````

Hope you like it
Thx
@sparrownor1

@Sparrownor1 Nice job. There isn’t a whole lot to change. The only thing I would suggest are variable names that match what they’re being used for. If you try to change the program at a latter date, you might not remember what variables are what. It doesn’t really matter on a small program like this, but once you start writing larger ones, it will.

@Sparrownor1 If you want, add this to setup — `parameter.text("TitleText", "Whee!")`, and change `text("Whee!", WIDTH/2, 700)` to `text(TitleText, WIDTH/2, 700)`.

Thx guys

@dave1707, maybe you got the wrong meaning… I didn’t mean fix it, I meant modify it and make it cooler… I want to see how other people make it better! Feel free to change it ,

@Sparrownor1 - there’s any number of things you can do. If you search on bouncing balls (see search box above right), you should find some of them. It’s really up to you.

But I would suggest you try adding small changes yourself, and also try a variety of projects, keeping it simple until your skills build up.

Here’s a cool variation of your code:

``````
--# Main
-- Bouncy Ball
supportedOrientations(LANDSCAPE_ANY)
-- Use this function to perform your initial setup
function setup()
backingMode(RETAINED)
Colors={  col = vec4(67, 255, 0, 255), col2 = vec4(255, 0, 0, 255)}
parameter.number("Mov",0,1024,Mov)
parameter.number("A",0,HEIGHT,A)
displayMode(FULLSCREEN)
print("BUNGEE JUMPING!!!!")
V=7
Mov=WIDTH/2
A=HEIGHT/2
VA=10
color(235, 0, 255, 255)
t1 = tween(1, Colors, {col = vec4(205,31,0,255), col2 = vec4(255,0,235,255)}, {loop = tween.loop.pingpong})
end

-- This function gets called once every frame
function touched(touch)
if touch.state==ENDED then
V=-V
VA=-VA
end

end

function draw()
C1 = color(Colors.col.x,Colors.col.y,Colors.col.z,Colors.col.w)
C2 = color(Colors.col2.x,Colors.col2.y,Colors.col2.z,Colors.col2.w)
fill(C1)
stroke(C2)
-- This sets the line thickness
--  FillColor=math.random(0, 255)
strokeWidth(1)
line(0,HEIGHT/2,Mov,A)
line(WIDTH,HEIGHT/2,Mov,A)
ellipse(Mov, A, 50)
-- sprite("Space Art:Asteroid Large", Mov, A)
Mov = Mov + V
A = A + VA
if A>HEIGHT-25 or A<25 then
VA=-VA
end
if Mov>WIDTH-25 or Mov<25 then
V=-V
end
end

``````