/traderous

To get this branch, use:
bzr branch /bzr/traderous

« back to all changes in this revision

Viewing changes to player.lua

  • Committer: Josh C
  • Date: 2013-05-09 01:26:36 UTC
  • Revision ID: josh@9ix.org-20130509012636-1hgzcgai2xtj0lfw
dead zone with no acceleration

Show diffs side-by-side

added added

removed removed

29
29
   onStartFrame = function(self)
30
30
                     --- TAKE 2
31
31
 
32
 
                     self.rotation = math.atan2(
33
 
                        love.mouse.getY() - the.app.height / 2,
34
 
                        love.mouse.getX() - the.app.width / 2
 
32
                     local mouseVec = vector.new(
 
33
                        love.mouse.getX() - the.app.width / 2,
 
34
                        love.mouse.getY() - the.app.height / 2
35
35
                     )
36
36
 
37
 
                     self.acceleration = vector.new(500, 0)
38
 
                     self.acceleration:rotate_inplace(self.rotation)
 
37
                     self.rotation = math.atan2(mouseVec.y, mouseVec.x)
 
38
 
 
39
                     if mouseVec:len2() > 64^2 then
 
40
                        self.acceleration = vector.new(500, 0)
 
41
                        self.acceleration:rotate_inplace(self.rotation)
 
42
                     else
 
43
                        self.acceleration = {x=0, y=0}
 
44
                     end
39
45
 
40
46
                     if the.mouse:pressed() and -- assumes left button
41
47
                       love.timer.getTime() - self.lastFired > 0.25 and