Advertisement
joseleeph

Untitled

Apr 16th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. function love.load()
  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. end
  13. function love.update(dt)
  14. if love.keyboard.isDown("up") then
  15. a = a*2*dt
  16. end
  17. if love.keyboard.isDown("down") then
  18. a = a/2*dt
  19. end
  20. if love.keyboard.isDown("left") then
  21. b = b*2*dt
  22. end
  23. if love.keyboard.isDown("right") then
  24. b = b/2*dt
  25. end
  26. end
  27.  
  28.  
  29. function love.draw() -- render to window
  30. love.graphics.setColor(200/255, 215/255, 0/255)
  31. delthe = math.pi/60 -- 3 degrees
  32. x = 0
  33. p = 1
  34. ps = 4 -- phase shift of 4
  35. odeg = math.pi/180
  36. for theta = -32*math.pi, 32*math.pi, odeg do
  37. love.graphics.line(x, a*math.sin(b*(theta))+windowwidth/2, x+odeg, a*math.sin(b*theta+odeg)+windowwidth/2)
  38. x = x + 0.1
  39. end
  40. end
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement