joseleeph

Untitled

Apr 16th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. function love.load() -- do global variables get declared here?
  2. windowwidth = 1000
  3. windowheight = 1000
  4. sucess = love.window.setMode(windowwidth, windowheight)
  5. x = 30
  6. y = 50
  7. z = math.sin(math.pi/3)
  8. cx = 0
  9. cy = 0
  10. a = 20
  11. b = 1/4
  12. ps = 0
  13. end
  14. function love.update(dt)
  15.  
  16.  
  17. local m = math.pow(2, dt)
  18. if love.keyboard.isDown("up") then
  19. a = a*m
  20. end
  21. if love.keyboard.isDown("down") then
  22. a = a/m
  23. end
  24. if love.keyboard.isDown("right") then
  25. b = b*m
  26. end
  27. if love.keyboard.isDown("left") then
  28. b = b/m
  29. end
  30. if love.keyboard.isDown("a") then
  31. ps = ps - 1
  32. end
  33. if love.keyboard.isDown("s") then
  34. ps = ps + 1
  35. end
  36. end
  37. function love.draw() -- render to window
  38.  
  39. love.graphics.setColor(200/255, 215/255, 0/255)
  40. delthe = math.pi/60 -- 3 degrees
  41. x = 0
  42.  
  43. odeg = math.pi/180
  44.  
  45. for theta = -32*math.pi, 32*math.pi, odeg do
  46.  
  47. love.graphics.line(x, a*math.sin(b*(theta + ps))+windowwidth/2, x+odeg, a*math.sin(b*theta+odeg + ps + 0.1)+windowwidth/2)
  48.  
  49. x = x + 0.1
  50. end
  51.  
  52. end
  53.  
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment