/traderous

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-06-19 01:06:14 UTC
  • Revision ID: josh@9ix.org-20130619010614-j3rbcv1c0my2tw0f
enemy shields and death

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
require 'boom'
19
19
require 'planet'
20
20
require 'trade_view'
 
21
require 'shield'
21
22
 
22
23
util = {
23
24
   signOf = function(value)
85
86
              the.interface = Group:new()
86
87
              the.planets = Group:new()
87
88
              the.indicators = Group:new()
 
89
              the.enemies = Group:new()
88
90
 
89
91
              the.bg = Tile:new{
90
92
                 image = 'data/stars3.png',
99
101
              the.player = SpacePlayer:new{x=the.bg.width / 2, y=the.bg.height / 2}
100
102
              self:add(the.player)
101
103
              self:add(the.player.thrust)
 
104
              self:add(the.player.shield)
 
105
 
 
106
              self:add(the.enemies)
102
107
 
103
108
              local e = Enemy:new{x=400, y=300}
104
109
              --local e = Enemy:new{x=the.bg.width / 2, y=the.bg.height / 2}
105
 
              self:add(e)
 
110
              the.enemies:add(e)
106
111
              self:add(e.thrust) -- why doesn't this work in Enemy.new?
 
112
              self:add(e.shield)
107
113
 
108
114
              self:add(the.bullets)
109
115
              self:add(the.indicators)
131
137
           end,
132
138
   onUpdate = function(self, dt)
133
139
                 the.bullets:collide(the.planets)
 
140
                 the.bullets:collide(the.player)
 
141
                 the.bullets:collide(the.enemies)
134
142
              end,
135
143
   onEndFrame = function(self)
136
144
                   the.interface.translate.x = the.player.x - the.app.width / 2 + the.player.width / 2