Advertisement
joseleeph

Untitled

Apr 15th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 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. end
  11.  
  12. function love.update(dt) -- added dt as a parameter ... is dt 1/framerate?
  13. if love.keyboard.isDown("up") then
  14. repeat
  15. a = a*2*dt
  16. until(love.keyreleased("up"))
  17. --a = a*2
  18. end
  19. if love.keyboard.isDown("down") then
  20. repeat
  21. a = a/2*dt
  22. until(love.keyreleased("down"))
  23. --a = a*2
  24. end
  25. if love.keyboard.isDown("left") then
  26. repeat
  27. b = b*2*dt
  28. until(love.keyreleased("left"))
  29. --a = a*2
  30. end
  31. if love.keyboard.isDown("right") then
  32. repeat
  33. b = b/2*dt
  34. until(love.keyreleased("right"))
  35. --a = a*2
  36. end
  37. end
  38.  
  39. function love.draw() -- render to window
  40. -- y = asin(bx + c)
  41. love.graphics.setColor(200/255, 215/255, 0/255)
  42. delthe = math.pi/60 -- 3 degrees
  43. a = 20
  44. x = 0
  45. p = 1
  46. b = 3
  47. ps = 4 -- phase shift of 4
  48. odeg = math.pi/180
  49. for theta = -32*math.pi, 32*math.pi, odeg do
  50. love.graphics.line(x, a*math.sin(b*(theta))+windowwidth/2, x+odeg, a*math.sin(b*theta+odeg)+windowwidth/2)
  51. x = x + 0.1
  52. end
  53. love.update()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement