Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- concommand.Add("BouncyBall",function(u)
- local frame = vgui.Create("DFrame")
- local x = 200
- local y = 200
- local Yvelocity = 0
- local Xvelocity = 0
- frame:SetPos(0,0)
- frame:SetSize(400,400)
- frame:MakePopup()
- hook.Add("Tick","gwegh2g22",function()
- if frame:IsValid() then
- function frame:PaintOver()
- draw.RoundedBox(8,x,y,20,20,Color(255,0,0))
- end
- if y>=frame:GetTall() - 20 then
- y=frame:GetTall() - 20
- else
- Yvelocity = Yvelocity + 1
- y=y+Yvelocity
- end
- x=x+Xvelocity
- if input.IsKeyDown(KEY_UP) && y>=frame:GetTall() - 20 then
- y=y-1
- Yvelocity = -10
- end
- if x>=frame:GetWide() - 20 then
- x=frame:GetWide() - 20
- Xvelocity=0
- end
- if x<=0 then
- x=0
- Xvelocity=0
- end
- if input.IsKeyDown(KEY_RIGHT) then
- if x<=frame:GetWide() - 30 then
- Xvelocity=Xvelocity+1
- end
- elseif Xvelocity >= 1 then
- Xvelocity=Xvelocity-1
- end
- if input.IsKeyDown(KEY_LEFT) then
- if x>=10 then
- Xvelocity=Xvelocity-1
- end
- elseif Xvelocity <= -1 then
- Xvelocity=Xvelocity+1
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement