/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 20:49:59 UTC
  • Revision ID: josh@9ix.org-20131214204959-sbwlos88we9pckgo
... add the map.  and the extra code to work w/ it.

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