diff options
| author | 1029chris <1029chris@gmail.com> | 2016-04-19 19:54:54 -0700 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2016-04-19 19:54:54 -0700 |
| commit | f266540b1784dd5dea85722948651173e8964399 (patch) | |
| tree | a88a065ea85b75491d09754e6714421d1ec8ffb1 | |
| parent | 52aabb377965f327cf580c5d183e3265d686ddf5 (diff) | |
Viruses eye follows the mouse
| -rw-r--r-- | assets.lua | 2 | ||||
| -rw-r--r-- | virus1.lua | 12 |
2 files changed, 13 insertions, 1 deletions
@@ -148,6 +148,8 @@ function loadAssets() v1.c.sp = 2 v1.c.angle = 0 v1.c.load = false + v1.c.eyex = 0 + v1.c.eyey = 0 expl = {} expl.frames = {} expl.pic = love.graphics.newImage("assets/explosion.png") @@ -37,7 +37,17 @@ function drawVirusFight1() playAnimation(v1.c.idle, true, v1.c.x-40, v1.c.y+40, v1.c.r, v1.c.s, 100, 100, 0.5) love.graphics.setColor(255,255,255) love.graphics.draw(v1.c.eye, v1.c.x-32, v1.c.y-50, v1.c.r, v1.c.s*0.9, v1.c.s*1.1) - love.graphics.draw(v1.c.pupil, v1.c.x+7+math.random(0,0.5), v1.c.y-28+math.random(0,0.5), v1.c.r, v1.c.s*1.2, v1.c.s*1.2, 3, 11) + if sys.mouse.x > v1.c.x+7+v1.c.eyex and v1.c.eyex < 15 then + v1.c.eyex = v1.c.eyex + 3 + elseif sys.mouse.x < v1.c.x+7+v1.c.eyex and v1.c.eyex > -15 then + v1.c.eyex = v1.c.eyex - 3 + end + if sys.mouse.y > v1.c.y-28+v1.c.eyey and v1.c.eyey < 5 then + v1.c.eyey = v1.c.eyey + 3 + elseif sys.mouse.y < v1.c.y-28+v1.c.eyey and v1.c.eyey > -10 then + v1.c.eyey = v1.c.eyey - 3 + end + love.graphics.draw(v1.c.pupil, v1.c.x+7+v1.c.eyex+math.random(0,0.5), v1.c.y-28+v1.c.eyey+math.random(0,0.5), v1.c.r, v1.c.s*1.2, v1.c.s*1.2, 3, 11) playAnimation(v1.c.idle, true, v1.c.x, v1.c.y, v1.c.r, v1.c.s, 100, 100, 0.5) if v1.c.shine.s < -50 and v1.msgs[v1.c.chat.msgs] ~= nil then drawBubble(v1.c.x+40, v1.c.y-165, 300, 110, v1.c.chat.msg) |
