Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load() -- do global variables get declared here?
- windowwidth = 1000
- windowheight = 1000
- sucess = love.window.setMode(windowwidth, windowheight)
- x = 30
- y = 50
- z = math.sin(math.pi/3)
- cx = 0
- cy = 0
- end
- function love.update(dt) -- added dt as a parameter ... is dt 1/framerate?
- if love.keyboard.isDown("up") then
- a = a*2
- end
- if love.keyboard.isDown("down") then
- a = a/2
- end
- if love.keyboard.isDown("left") then
- b = b*2
- end
- if love.keyboard.isDown("right") then
- b = b/2
- end
- end
- function love.draw() -- render to window
- -- y = asin(bx + c)
- love.graphics.setColor(200/255, 215/255, 0/255)
- delthe = math.pi/60 -- 3 degrees
- a = 20
- x = 0
- p = 1
- b = 3
- ps = 4 -- phase shift of 4
- odeg = math.pi/180
- for theta = -32*math.pi, 32*math.pi, odeg do
- love.graphics.line(x, a*math.sin(b*(theta))+windowwidth/2, x+odeg, a*math.sin(b*theta+odeg)+windowwidth/2)
- -- phaseshift = 3 for an interesting pattern
- -- love.graphics.line(x, a*math.sin(theta/ps)+windowwidth/2, x+odeg, a*math.sin(theta/ps+odeg)+windowwidth/2)
- x = x + 0.1
- end
- love.update()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement