Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Oct 3, 2024
1 parent ddc7bca commit 71f90b8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ engine:prefetch({


local player = engine:spawn("player")
player:set_action("run")
player:set_action("idle")
player:set_placement(0, 580)

local function loop(delta)
Expand All @@ -37,7 +37,18 @@ player:on_update(function(self)
end

if engine:is_keydown(KeyEvent.space) then
velocity.y = -3
velocity.y = -.8
end

if velocity:moving() then
self:set_action("run")
if velocity:right() then
self:set_flip(Flip.none)
elseif velocity:left() then
self:set_flip(Flip.horizontal)
end
elseif velocity:stationary() then
self:set_action("idle")
end

self:set_velocity(velocity)
Expand Down

0 comments on commit 71f90b8

Please sign in to comment.