/ld28

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-12-14 22:33:14 UTC
  • Revision ID: josh@9ix.org-20131214223314-gxlkcixtm6ma1mlr
put some walls and a goal... doesn't feel quite right.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
require 'version'
11
11
require 'player'
12
12
require 'clone'
 
13
require 'goal'
13
14
 
14
15
GameView = View:extend {
15
16
   onNew = function (self)
16
17
              self:loadLayers('data/map.lua')
17
18
 
 
19
              local tw = math.floor(the.app.width / 16)
 
20
              local th = math.floor(the.app.height / 16)
 
21
 
18
22
              the.player = Player:new{
19
 
                 x = math.random(the.app.width),
20
 
                 y = math.random(the.app.height),
 
23
                 x = math.random(2, tw-2) * 16,
 
24
                 y = math.random(2, th-2) * 16
21
25
              }
22
26
              self:add(the.player)
23
27
 
24
28
              the.clones = Group:new()
25
29
              self:add(the.clones)
26
 
              for _ = 1, 14 do
 
30
              for _ = 1, 15 do
27
31
                 the.clones:add(Clone:new {
28
 
                                       x = math.random(16, the.app.width-32),
29
 
                                       y = math.random(16, the.app.height-32),
30
 
                                    })
 
32
                                   x = math.random(2, tw-2) * 16,
 
33
                                   y = math.random(2, th-2) * 16
 
34
                                })
31
35
              end
32
36
           end,
33
37
   onUpdate = function(self, dt)
54
58
 
55
59
the.app = App:new {
56
60
   name = "LD28",
 
61
   fps = 30,
57
62
   onRun = function (self)
58
63
              print('Version: ' .. VERSION)
59
64