/traderous

To get this branch, use:
bzr branch http://9ix.org/bzr/traderous

« back to all changes in this revision

Viewing changes to enemy.lua

  • Committer: Josh C
  • Date: 2013-06-23 02:28:12 UTC
  • Revision ID: josh@9ix.org-20130623022812-zhz3azvff45bgsw1
bigger space, slower movement, maintain enemy density

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
                     if pdist2 < (the.app.width / 2)^2 then
52
52
                        -- if player is roughly on enemy's screen
53
 
                        if self.state == 'patrolling' and the.player.active and not the.player.onPlanet then
 
53
                        if self.state == 'patrolling' and the.player.active then
54
54
                           self.state = 'combat'
55
55
                           self.target = the.player
56
56
                        end
112
112
                        the.enemies:remove(self)
113
113
                        the.app.view:remove(self.thrust)
114
114
                        the.app.view:remove(self.shield)
115
 
 
116
 
                        -- and add a new enemy somewhere else...
117
 
                        local e = Enemy:new{x = math.random(the.bg.width),
118
 
                                            y = math.random(the.bg.height)}
119
 
                        the.enemies:add(e)
120
 
                        the.view:add(e.thrust)
121
 
                        the.view:add(e.shield)
122
115
                     else
123
116
                        self.shield:onHit()
124
117
                     end