Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if CLIENT then
- concommand.Add("BallGame",function(u,c,a)
- local frame = vgui.Create("DFrame")
- local u = LocalPlayer()
- frame:SetSize(400,400)
- frame:SetPos(0,0)
- frame:SetTitle("Ball Game")
- frame:MakePopup()
- local shop = vgui.Create("DButton",frame)
- shop:SetPos(0,25)
- shop:SetSize(frame:GetWide() / 3,20)
- shop:SetText("Purchase Rainbow! $10")
- function shop:DoClick()
- if !u.rainbow then
- if u.COINS >= 10 then
- u.rainbow = true
- u.COINS = u.COINS - 10
- shop:SetText("Rainbow Purchased!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop:SetText("Purchase Rainbow! $10")
- end
- end)
- else
- shop:SetText("Collect More Coins!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop:SetText("Purchase Rainbow! $10")
- end
- end)
- end
- else
- shop:SetText("Already Owned!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop:SetText("Purchase Rainbow! $10")
- end
- end)
- end
- end
- local shop2 = vgui.Create("DButton",frame)
- shop2:SetPos(shop:GetWide(),25)
- shop2:SetSize(frame:GetWide() / 3,20)
- shop2:SetText("Speed Boost! $5")
- function shop2:DoClick()
- if u.rainbow then
- if u.COINS >= 5 then
- u.speed = u.speed + 5
- u.COINS = u.COINS - 5
- shop2:SetText("Boost Purchased!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop2:SetText("Speed Boost! $5")
- end
- end)
- else
- shop2:SetText("Collect More Coins!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop2:SetText("Speed Boost! $5")
- end
- end)
- end
- else
- shop2:SetText("You need Rainbow!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop2:SetText("Speed Boost! $5")
- end
- end)
- end
- end
- local shop3 = vgui.Create("DButton",frame)
- shop3:SetPos(shop:GetWide() + shop2:GetWide(),25)
- shop3:SetSize(frame:GetWide() / 3,20)
- shop3:SetText("Jump Boost! $10")
- function shop3:DoClick()
- if u.rainbow then
- if u.COINS >= 10 then
- u.jump = u.jump + 2.5
- u.COINS = u.COINS - 10
- shop3:SetText("Boost Purchased!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop3:SetText("Jump Boost! $10")
- end
- end)
- else
- shop3:SetText("Collect More Coins!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop3:SetText("Jump Boost! $10")
- end
- end)
- end
- else
- shop3:SetText("You need Rainbow!")
- timer.Simple(1,function()
- if frame:IsValid() then
- shop3:SetText("Jump Boost! $10")
- end
- end)
- end
- end
- frame.t = 0
- frame.b = 400
- frame.l = 0
- frame.r = 400
- u.rainbow = false
- u.color = Color(0,255,0,255)
- u.size = 20
- u.x = 190
- u.y = 30
- u.COINS = 0
- u.gravity = 0
- u.weight = 0.3
- u.speed = 5
- u.jump = 15
- u.coinx = math.random(frame.l,frame.r)
- u.coiny = math.random(frame.t,frame.b)
- u.coincolor = Color(200,200,0,255)
- u.coinsize = 20
- u.coinvalid = true
- hook.Add("Tick","3gb23v",function()
- if frame:IsValid() then
- frame:SetPos(frame.l,frame.t)
- frame:SetSize(frame.r,frame.b)
- function frame:Paint()
- draw.RoundedBox(0,frame.l,frame.t,frame.r,frame.b,Color(0,0,0,255))
- draw.RoundedBox(8,u.x,u.y,u.size,u.size,u.color)
- draw.RoundedBox(8,u.coinx,u.coiny,u.coinsize,u.coinsize,u.coincolor)
- draw.DrawText(u.COINS,"DermaLarge",frame.r / 2,frame.b / 1.5,Color(255,255,255,255))
- end
- if u.rainbow then
- u.color = Color(math.random(1,255),math.random(1,255),math.random(1,255))
- end
- u.gravity = u.gravity + 1
- if u.y >= frame.b - u.size then
- u.gravity = 0
- u.y = frame.b - u.size
- elseif u.y <= frame.b - u.size then
- u.y = (u.y + u.gravity)+u.weight
- end
- if (u.x + u.size >= u.coinx && u.x <= u.coinx + u.coinsize) && (u.y + u.size >= u.coiny && u.y <= u.coiny + u.coinsize) then
- if u.coinvalid then
- u.coinvalid = false
- u.COINS = u.COINS + 1
- u.coinx = math.random(frame.l,frame.r)
- u.coiny = math.random(frame.t,ScrH())
- u.coinvalid = true
- end
- end
- /*-------------------------------------
- -----ADD KEY BINDS BELOW HERE!!!!------
- */-------------------------------------
- if input.IsKeyDown(KEY_UP) then
- if u.y == frame.b - u.size then
- u.y=u.y-1
- u.gravity = u.gravity - u.jump
- end
- end
- if input.IsKeyDown(KEY_RIGHT) then
- if u.x <= frame.r - u.size then
- u.x = u.x + u.speed
- end
- end
- if input.IsKeyDown(KEY_LEFT) then
- if u.x >= frame.l then
- u.x = u.x - u.speed
- end
- end
- if input.IsKeyDown(KEY_PAD_8) then
- if frame.b >= frame.t + u.size then
- frame.b = frame.b - u.speed
- end
- end
- if input.IsKeyDown(KEY_PAD_2) then
- if frame.b <= ScrH() then
- frame.b = frame.b + u.speed
- end
- end
- end
- end)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement