Advertisement
Guest User

LuaLove123

a guest
Dec 7th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. mouse = {}
  2. circle = {}
  3. enemy = {}
  4.  
  5. function love.load()
  6.   circle.mode = "fill"  
  7.   circle.x = 0
  8.   circle.y = 0
  9.   circle.radius = 15
  10.  
  11.   enemy.mode = "fill"
  12.   enemy.x = love.math.random(0, 800)
  13.   enemy.y = love.math.random(-15, -50)
  14.   enemy.width = love.math.random(10, 100)
  15.   enemy.height = love.math.random(10, 100)
  16. end
  17.  
  18.  
  19. function love.update(dt)
  20.   mouse.x, mouse.y = love.mouse.getPosition()
  21.  
  22.   circle.x = mouse.x
  23.   circle.y = mouse.y
  24.  
  25.   enemy.y = enemy.y + love.math.random(200, 500) * dt -- falling speed
  26. end
  27.  
  28.  
  29. function love.draw()
  30.   love.graphics.setColor(0, 1, 0)
  31.   love.graphics.circle(circle.mode, circle.x, circle.y, circle.radius)
  32.  
  33.   love.graphics.setColor(1, 0, 0)
  34.   love.graphics.rectangle(enemy.mode, enemy.x, enemy.y, enemy.width, enemy.height)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement