Ver código fonte

Tweeet and tutorial;

bjorn 10 anos atrás
pai
commit
5de8213e02
4 arquivos alterados com 25 adições e 6 exclusões
  1. 3 3
      deps/view.lua
  2. 4 2
      game.lua
  3. 17 0
      hud.lua
  4. 1 1
      pigeon.lua

+ 3 - 3
deps/view.lua

@@ -230,9 +230,9 @@ function View:worldPoint(x, y)
 end
 
 function View:screenPoint(x, y)
-  local vx, vy = lume.lerp(self.prevx, self.x, ls.accum / ls.tickrate), lume.lerp(self.prevy, self.y, ls.accum / ls.tickrate)
-  x = (x - vx) * self.scale
-  if y then y = (y - vy) * self.scale end
+  local vx, vy, s = unpack(table.interpolate({self.prevx, self.prevy, self.prevscale}, {self.x, self.y, self.scale}, ls.accum / ls.tickrate))
+  x = (x - vx) * s
+  if y then y = (y - vy) * s end
   return x, y
 end
 

+ 4 - 2
game.lua

@@ -51,7 +51,7 @@ function Game:load(level, levelIndex)
 end
 
 function Game:update()
-  self.debug = love.keyboard.isDown('`')
+  self.debug = false--love.keyboard.isDown('`')
 
   if self.paused then
     self.pigeon:paused()
@@ -72,7 +72,7 @@ function Game:update()
   self.view:update()
   self.hud:update()
 
-  ls.timescale = love.keyboard.isDown('r') and 5 or 1
+  ls.timescale = 1--love.keyboard.isDown('r') and 5 or 1
 
   if joystick then
     if ctx.hud.win.active and joystick:isGamepadDown('a') then
@@ -121,6 +121,8 @@ function Game:keypressed(key)
       index = ctx.map.index + 1
     end
     Context:add(Game, world, index)
+  elseif ctx.hud.win.active and key == 't' then
+    ctx.hud:share()
   end
 
   self.pigeon:keypressed(key)

+ 17 - 0
hud.lua

@@ -401,6 +401,23 @@ function Hud:gui()
     g.print(str, x - g.getFont():getWidth(str) / 2 + 2, gh - 55 + 2)
     g.setColor(255, 255, 255, alpha * 255)
     g.print(str, x - g.getFont():getWidth(str) / 2, gh - 55)
+
+    g.setFont('media/fonts/runescape.ttf', 16)
+    local str = 'Press T to tweet your score!'
+    g.setColor(0, 0, 0)
+    g.print(str, x - g.getFont():getWidth(str) / 2 + 1, gh - 24 + 1)
+    g.setColor(255, 255, 255)
+    g.print(str, x - g.getFont():getWidth(str) / 2, gh - 24)
+  end
+
+  if ctx.map.name == 'dinoland' and ctx.map.index == 1 then
+    local x, y = ctx.view:screenPoint(1067 / 2, ctx.map.height - 40)
+    local str = 'Up = Jump, Space = Peck'
+    g.setFont('media/fonts/handDrawnShapes.ttf', 30)
+    g.setColor(0, 0, 0)
+    g.print(str, x - g.getFont():getWidth(str) / 2 + 1, y - g.getFont():getHeight() / 2 + 1)
+    g.setColor(255, 255, 255)
+    g.print(str, x - g.getFont():getWidth(str) / 2, y - g.getFont():getHeight() / 2)
   end
 end
 

+ 1 - 1
pigeon.lua

@@ -511,7 +511,7 @@ function Pigeon.walk:update()
 
   if love.keyboard.isDown('up', 'w', 'z') or (joystick and (joystick:getGamepadAxis('lefty') < -.5 or joystick:isGamepadDown('a', 'dpup'))) then
     return self:changeState('air')
-  elseif (love.keyboard.isDown(' ', 'down', 's', 'x') or (joystick and (joystick:isGamepadDown('b', 'x', 'y')))) and not self.peckDirty then
+  elseif (love.keyboard.isDown(' ', 's', 'x') or (joystick and (joystick:isGamepadDown('b', 'x', 'y')))) and not self.peckDirty then
     self:changeState('peck')
   end