summaryrefslogtreecommitdiff
path: root/examples/platformer/main.lua
diff options
context:
space:
mode:
authorjussi2022-09-22 20:25:18 +0300
committerjussi2022-09-22 20:25:18 +0300
commit0fad8239b626678980f7f8093c0602acbe5c817b (patch)
tree2c6f9f3fcf0f873c89d231d512fe1c006e9f7074 /examples/platformer/main.lua
parente5f437d05e8277861ea85e6c8d2ede32c4be32ef (diff)
downloadreilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.tar.gz
reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.tar.bz2
reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.zip
v0.3.
Diffstat (limited to 'examples/platformer/main.lua')
-rw-r--r--examples/platformer/main.lua28
1 files changed, 1 insertions, 27 deletions
diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua
index 0032d0d..d68b3b8 100644
--- a/examples/platformer/main.lua
+++ b/examples/platformer/main.lua
@@ -32,7 +32,7 @@ local tilemap = {
local player = {
vel = Vec2:new( 0, 0 ),
- pos = Vec2:new( 32, 32 ), -- Center down.
+ pos = Vec2:new( 32, 32 ), -- Center bottom.
colRect = { 0, 0, 12, 14 },
onFloor = false,
frames = {
@@ -49,11 +49,6 @@ local player = {
facing = 1,
}
-local kissa = { Vec2:new( 2, 4 ), 23 }
-
--- print( table.concat( kissa ) )
-print( kissa[1] )
-
local function createMap()
for x = 1, tilemap.size.x do
table.insert( tilemap.tiles, {} )
@@ -199,16 +194,6 @@ local function playerMovement( delta )
end
end
- -- Alternative top down movement.
-
- -- if RL_IsKeyDown( KEY_DOWN ) then
- -- player.vel.y = player.vel.y + PLAYER_ACCELL * delta
- -- moving[2] = true
- -- elseif RL_IsKeyDown( KEY_UP ) then
- -- player.vel.y = player.vel.y - PLAYER_ACCELL * delta
- -- moving[2] = true
- -- end
-
if RL_IsKeyPressed( KEY_SPACE ) and player.onFloor then
player.vel.y = -JUMP_STR
player.onFloor = false
@@ -226,18 +211,7 @@ local function playerMovement( delta )
end
end
- -- if not moving[2] then
- -- if delta * PLAYER_DEACCELL < player.vel.y then
- -- player.vel.y = player.vel.y - PLAYER_DEACCELL * delta
- -- elseif player.vel.y < -delta * PLAYER_DEACCELL then
- -- player.vel.y = player.vel.y + PLAYER_DEACCELL * delta
- -- else
- -- player.vel.y = 0.0
- -- end
- -- end
-
player.vel.x = util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
- -- player.vel.y = util.clamp( player.vel.y, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
player.vel.y = player.vel.y + GRAVITY * delta