Skip to content

Commit 983e033

Browse files
committed
add right handed controls (esdf); draw points on mb. nodes
1 parent a20982e commit 983e033

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

main.lua

+16-14
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,12 @@ function updateCell(_n,dt)
271271
c.dir = math.atan2(player.y-c.nucleus.y,player.x-c.nucleus.x)
272272
end
273273
local dir = c.dir
274-
--[[if love.keyboard.isDown("right","left","down","up") then
274+
--[[if love.keyboard.isDown("right","f","left","s","down","d","up","e") then
275275
acc = mediumDamping * c.genes.speed
276-
if love.keyboard.isDown("right") then dir = 0 end
277-
if love.keyboard.isDown("left") then dir = math.pi end
278-
if love.keyboard.isDown("down") then dir = 0.5*math.pi end
279-
if love.keyboard.isDown("up") then dir = 1.5*math.pi end
276+
if love.keyboard.isDown("right","f") then dir = 0 end
277+
if love.keyboard.isDown("left","s") then dir = math.pi end
278+
if love.keyboard.isDown("down","d") then dir = 0.5*math.pi end
279+
if love.keyboard.isDown("up","e") then dir = 1.5*math.pi end
280280
end]]
281281
nax = nax + acc*math.cos(dir)
282282
nay = nay + acc*math.sin(dir)
@@ -287,7 +287,7 @@ function updateCell(_n,dt)
287287
local continue = false
288288
local newax = 0
289289
local neway = 0
290-
--check for collisions:
290+
--check for COLLISIONS:
291291
--with player:
292292
if distance(c.membrane[i],c.membrane[i+1],player.x,player.y) < plen+2 then
293293
hitPlayer(1)
@@ -421,16 +421,16 @@ function love.update(dt)
421421
if love.mouse.isDown("l","r") then fire(mx,my) end
422422

423423
local md = nil
424-
if love.keyboard.isDown("right") then
425-
if love.keyboard.isDown("up") then md = 1.75*math.pi
426-
elseif love.keyboard.isDown("down") then md = 0.25*math.pi
424+
if love.keyboard.isDown("right","f") then
425+
if love.keyboard.isDown("up","e") then md = 1.75*math.pi
426+
elseif love.keyboard.isDown("down","d") then md = 0.25*math.pi
427427
else md = 0 end
428-
elseif love.keyboard.isDown("left") then
429-
if love.keyboard.isDown("up") then md = 1.25*math.pi
430-
elseif love.keyboard.isDown("down") then md = 0.75*math.pi
428+
elseif love.keyboard.isDown("left","s") then
429+
if love.keyboard.isDown("up","e") then md = 1.25*math.pi
430+
elseif love.keyboard.isDown("down","d") then md = 0.75*math.pi
431431
else md = math.pi end
432-
elseif love.keyboard.isDown("up") then md = 1.5*math.pi
433-
elseif love.keyboard.isDown("down") then md = 0.5*math.pi end
432+
elseif love.keyboard.isDown("up","e") then md = 1.5*math.pi
433+
elseif love.keyboard.isDown("down","d") then md = 0.5*math.pi end
434434

435435
local nax,nay = 0,0
436436

@@ -537,5 +537,7 @@ function love.draw()
537537
love.graphics.setColor(255,255,255,255)
538538
love.graphics.polygon("line",c.membrane)
539539
love.graphics.circle("line",c.nucleus.x,c.nucleus.y,2,10)
540+
love.graphics.setColor(0,0,0,255)
541+
for j = 1,c.mbsize,2 do love.graphics.point(c.membrane[j],c.membrane[j+1]) end
540542
end
541543
end

0 commit comments

Comments
 (0)