Advertisement
joseleeph

Untitled

May 7th, 2021
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1.  
  2. function love.load()
  3. --Object = require "classic"
  4. require "cjrcle"
  5. windowwidth = 1000
  6. windowheight = 1000
  7. sucess = love.window.setMode(windowwidth, windowheight) -- what does this line do? ... will work but the circle is offset
  8.  
  9. ctheta = math.pi/2
  10.  
  11. --cjrcle.x = cjrcle.x + math.cos(ctheta + math.pi/60*dt)
  12. --cjrcle.y = cjrcle.y + math.sin(ctheta + math.pi/60*dt) -- THESE LINES CAUSE AN ERROR!
  13.  
  14. circle = { -- properties cjrcle() objects
  15. xpos = 0,
  16. ypos = 0,
  17. radius = 100,
  18. image = cjrcle(100, x, y, 32),
  19. speed = 100
  20. }
  21.  
  22. end
  23.  
  24. function love.update(dt)
  25. x = 0
  26. y = 0
  27. theta = math.pi/2
  28.  
  29. cjrcle.xpos = cjrcle.xpos + math.cos(ctheta + math.pi/60*dt)
  30. cjrcle.ypos = cjrcle.ypos + math.sin(ctheta + math.pi/60*dt)
  31. theta = theta + math.pi/60
  32. end
  33.  
  34. function love.draw()
  35. --love.graphics.push()
  36. love.graphics.translate(windowwidth/2, windowheight/2)
  37.  
  38. x = 0
  39. y = 0
  40.  
  41. local segs = 64
  42. local ctheta = math.pi/2
  43.  
  44. love.graphics.setColor(1, 0, 0)
  45. love.graphics.setColor(0, 1, 0) -- green circle
  46. cjrcle(100, x, y, 32)
  47. love.graphics.setColor(0, 0, 0)-- black line
  48. love.graphics.line(100*math.cos(math.pi/2), 100*math.sin(math.pi/2), 100*math.cos(-math.pi/2), 100*math.sin(-math.pi/2))
  49.  
  50. --blue circle
  51. love.graphics.setColor(0, 0, 1) -- blue paint
  52. love.graphics.circle("fill", x + 100*math.cos(ctheta), y - 100*math.sin(ctheta), 10)
  53.  
  54.  
  55. love.graphics.setColor(1, 1, 0) -- yellow paint
  56. cjrcle(10, 100*math.cos(theta), -100*math.sin(theta), 16)
  57.  
  58. end
  59.  
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement