Skip to content

Commit

Permalink
viewport shaking
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Apr 28, 2013
1 parent fc55fb9 commit 2c2eff5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.moon
Expand Up @@ -217,6 +217,7 @@ class Platform

s.draw = -> -- lol
world.particles\add s
world.game.viewport\shake 20

class Wheel
segments: 6
Expand Down Expand Up @@ -267,6 +268,10 @@ class Game
@player = Player 0,0
@world = World @, @player
@hud = Hud @world
@viewport = with EffectViewport scale: 1
import effects from lovekit
.shake = (amount=20) =>
@effects\add effects.ViewportShake 0.8, 5, amount

on_key: (key, code) =>
if key == "p"
Expand Down Expand Up @@ -297,9 +302,13 @@ class Game
@player.gun\shoot @world

draw: =>
@viewport\apply!

@world\draw!
@hud\draw!

@viewport\pop!

if @show_fps
g.setColor 255,255,255
g.scale 2
Expand All @@ -312,6 +321,8 @@ class Game
update: (dt) =>
return if @paused


@viewport\update dt
@world\update dt
@hud\update dt, @world

Expand Down
1 change: 1 addition & 0 deletions player.moon
Expand Up @@ -189,4 +189,5 @@ class Player extends Entity
spray_dir = thing.vel\normalized!\flip!
thing.life = 0
world.particles\add BloodSquirt spray_dir, world, thing\center!
world.game.viewport\shake 5

0 comments on commit 2c2eff5

Please sign in to comment.