/zoeplat

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-03-05 22:11:35 UTC
  • Revision ID: josh@9ix.org-20130305221135-wrvf3q8vzc6xjdiy
some basic collision (and workarounds)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
require 'zoetrope'
5
5
 
6
 
Player = Animation:extend {
 
6
Player = Tile:extend {
7
7
   image = 'data/player.png',
8
 
   height = 32,
9
 
   width = 32,
10
 
   sequences = {
11
 
      stand = { frames = { 1 }, fps = 1 },
12
 
      walk = { frames = { 2, 3 }, fps = 5 },
13
 
      jump = { frames = { 4 }, fps = 1 }
14
 
   },
15
8
   onNew = function (self)
16
9
              self.velocity.y = 0
17
10
              self.maxVelocity.y = 400
25
18
 
26
19
                     if the.keys:pressed('left') then
27
20
                        self.velocity.x = -200
28
 
                        self:play('walk')
29
21
                     elseif the.keys:pressed('right') then
30
22
                        self.velocity.x = 200
31
 
                        self:play('walk')
32
 
                     else
33
 
                        self:play('stand')
34
23
                     end
35
24
 
36
25
                     if the.keys:justPressed('up') then