Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ang=0
- vel=1
- basket = {x=210,y=20,w=60,h=40}
- ball = {img=image.load("SYSTEM/resources/balls/usedball/ball.png"),x=240,y=136}
- ball.w= ball.img:width()
- ball.h= ball.img:height()
- radius=20
- score=0
- function colision(obj1,obj2)
- if obj1.x>= obj2.x and
- obj1.x+obj1.w <= obj2.x+obj2.w and
- obj1.y >= obj2.y and
- obj1.y+obj1.h <= obj2.y+obj2.h then
- return true else return false
- end
- end
- while true do
- ball.x=240+math.cos(math.rad(ang))*radius
- ball.y=136+math.sin(math.rad(ang))*radius
- ang=ang+vel
- controls.read()
- draw.rect(basket.x,basket.y,basket.w,basket.h,color.new(255,0,0))
- ball.img:blit(ball.x,ball.y)
- if controls.up() then radius=radius+0.5 end
- if controls.down() then radius=radius-0.5 end
- if controls.r() then vel=vel+0.1 end
- if controls.l() then vel=vel-0.1 end
- if controls.analogx() >100 then vel=vel+0.5 end
- if controls.analogx() <-100 then vel=vel-0.5 end
- if controls.press("cross") then
- if colision(ball,basket) then
- score=score+10
- end
- end
- screen.print(5,5,"Score: "..score.." Rad: "..radius.." Vel: "..vel)
- screen.print(5,25,"Up-Down radius")
- screen.print(5,45,"L-R velocity")
- if controls.select() then a() end
- screen.flip()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement